dcmodify vs. "ISO_IR 192" character set
Moderator: Moderator Team
dcmodify vs. "ISO_IR 192" character set
Hallo!
I'm dealing with a dicom file whose TAG (0008, 0005) holds "ISO_IR 192" (Utf-8).
Such file contains non ASCII characters, i.e. "à", "è", "ì": the dump produced from dcmdump.exe (v.3.6.2) gets a correct representation of those characters.
Now, i'm trying to use dcmodify tool (v.3.6.2) to modify TAG (0010, 0010) in order to insert in the corresponding Value "Niccolò".
The command line I use is: dcmodify -v -i "(0x0010, 0x0010)=Niccolò" IMAGES/0000.dcm
The result is incorrect, as character "ò" is encoded 0x28A6 instead of 0xc3b2 (U+00F2 - ò - LATIN SMALL LETTER O WITH GRAVE).
dcmdump confirms the introduction of wrong characters.
Is there a solution to this issue?
Thank you for any help, very appreciated!
Ilaria
I'm dealing with a dicom file whose TAG (0008, 0005) holds "ISO_IR 192" (Utf-8).
Such file contains non ASCII characters, i.e. "à", "è", "ì": the dump produced from dcmdump.exe (v.3.6.2) gets a correct representation of those characters.
Now, i'm trying to use dcmodify tool (v.3.6.2) to modify TAG (0010, 0010) in order to insert in the corresponding Value "Niccolò".
The command line I use is: dcmodify -v -i "(0x0010, 0x0010)=Niccolò" IMAGES/0000.dcm
The result is incorrect, as character "ò" is encoded 0x28A6 instead of 0xc3b2 (U+00F2 - ò - LATIN SMALL LETTER O WITH GRAVE).
dcmdump confirms the introduction of wrong characters.
Is there a solution to this issue?
Thank you for any help, very appreciated!
Ilaria
-
- DCMTK Developer
- Posts: 2512
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: dcmodify vs. "ISO_IR 192" character set
Maybe, the character set (aka codepage) of your shell (cmd.exe?) is not set appropriately. Did you check dcmdump's output on the console or in a text editor (which supports UTF-8)?
Re: dcmodify vs. "ISO_IR 192" character set
I'll check on the base of your hint, thank you in advance!
Best regards
Ilaria
Best regards
Ilaria
Re: dcmodify vs. "ISO_IR 192" character set
Hallo, after having checked my environment, I solved my issue by adding th following line code to my app:
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
In fact, I'm developping in the Qt framework and the problem was lying in the arguments list parsing performed by the QProcess class.
Hope, it could be useful for someone else.
Thank you and best regards.
Ilaria
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
In fact, I'm developping in the Qt framework and the problem was lying in the arguments list parsing performed by the QProcess class.
Hope, it could be useful for someone else.
Thank you and best regards.
Ilaria
Re: dcmodify vs. "ISO_IR 192" character set
Hello everybody,
I have a similar issue while using dcmodify with umlaut chars, like this:
This call seems to generate a wrong dicom file even if the starting dicom has the right charset "ISO_IR 192" (Utf-8).
Any hints on how to use the dcmodify with umlaut chars are welcome.
I have a similar issue while using dcmodify with umlaut chars, like this:
Code: Select all
dcmodify -v -nb -i "(0x0010, 0x2297)=Rossi^Märio" 0000.dcm
Any hints on how to use the dcmodify with umlaut chars are welcome.
Tried also using a batch file to change the charset of cmd.exe with "chcp 65001" right before calling dcmodify, but it doesn't seem to work ...J. Riesmeier wrote: ↑Fri, 2018-01-12, 19:14 Maybe, the character set (aka codepage) of your shell (cmd.exe?) is not set appropriately. Did you check dcmdump's output on the console or in a text editor (which supports UTF-8)?
-
- DCMTK Developer
- Posts: 2512
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: dcmodify vs. "ISO_IR 192" character set
You could also try with "-if file.txt", where file.txt contains the UTF-8 encoded string of characters.
By the way, there is no need to prefix the hex numbers with "0x".
In my bash (Linux shell), it works out of the box since the local encoding is set to UTF-8. Windows is always something special...
By the way, there is no need to prefix the hex numbers with "0x".
In my bash (Linux shell), it works out of the box since the local encoding is set to UTF-8. Windows is always something special...
Re: dcmodify vs. "ISO_IR 192" character set
Thank you so much for the prompt reply, I tried the following:J. Riesmeier wrote: ↑Thu, 2021-11-11, 18:19 You could also try with "-if file.txt", where file.txt contains the UTF-8 encoded string of characters.
Code: Select all
dcmodify -v -nb -if "(0010, 2297)"=file.txt 0000.dcm
ps. we'll think about switching to Linux sooner or later: D
-
- DCMTK Developer
- Posts: 2512
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: dcmodify vs. "ISO_IR 192" character set
You could e.g. create a so-called command file that contains all modifications, e.g. a "modify.txt" with the following contents (encoded as UTF-8):
And then call "dcmodify -v -nb @modify.txt 0000.dcm". You could also create multiple command files and then call dcmodify with multiple @<filename> arguments. This feature is documented in the manpages of the DCMTK tools.
Code: Select all
-i SpecificCharacterSet="ISO_IR 192"
-m PatientName="Riesmeier^Jörg"
-m PatientID=0815
-i PatientComments="Some Comment"
...
Re: dcmodify vs. "ISO_IR 192" character set
Thank you so much!
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest