본문 바로가기

카테고리 없음

dcmodify example

DCMTK의 dcmodify.exe 를 이용하여 DCM 파일안에 포함된  태그의 값을 수정하는 예

원문사이트 참조  http://support.dcmtk.org/docs/dcmodify.html


dcmodify.exe


환자의 아이디를 수정하는 예

Erase the tag: dcmodify.exe -e "(0010,0020)" sample.dcm


Add it again: dcmodify.exe -i "(0010,0020)=214560" sample.dcm



환자의 이름을 수정하는 예

dcmodify -e "(0010,0010)" sample.dcm


dcmodify -i "(0010,0010)=홍길동" sample.dcm



환자의 성별정보 수정 예

dcmodify -e "(0010,0040)" sample.dcm


dcmodify -i "(0010,0040)=M" sample.dcm



진료일자를 수정하는 예

dcmodify -e "(0008,0020)" sample.dcm


dcmodify -i "(0008,0020)=20130721" sample.dcm



EXAMPLES

-i --insert-tag:

dcmodify -i "(0010,0010)=A Name" file.dcm Inserts the PatientsName tag into 'file.dcm' at 1st level. If tag already exists, -i will overwrite it! If you want to insert an element with value multiplicity > 1 (e.g. 4) you can do this with: dcmodify -i "(0018,1310)=1\2\3\4"

dcmodify -i "(0008,1111)[0].PatientsName=Another Name" *.dcm Inserts PatientsName tag into the first item of sequence (0008,1111). Note that the use of wildcards for files is possible. You can specify longer tag paths, too (e.g. "(0008,1111)[0].(0008,1111)[1].(0010,0010)=A Third One").

-m --modify-tag: dcmodify -m "(0010,0010)=A Name" file.dcm Changes tag (0010,0010) on 1st level to "A Name".

This option also allows longer tag paths as demonstrated above for -i.

-ma --modify-all-tags: dcmodify -ma "(0010,0010)=New Name" file.dcm Does the same as -m but works on all matching tags found in 'file.dcm'. Therefore, it searches the whole dataset including sequences for tag (0010,0010) and changes them to "New Name"

-e --erase-tag: dcmodify -e "(0010,0010)" *.dcm Erases tag (0010,0010) in all *.dcm files at 1st level. Note: You can also erase whole sequences by using this option with a sequence tag, but in this version it's not possible to delete a single item in a sequence.

This option also allows longer tag paths as demonstrated above for -i.

-ea --erase-all-tags: dcmodify -ea "(0010,0010)" *.dcm Same as -e, but also searches in sequences and items.

-gst --gen-stud-uid: dcmodify -gst file.dcm This generates a new value for the StudyInstanceUID (0020,000d). Other UIDs are not modified!

-gse --gen-ser-uid: dcmodify -gse file.dcm This generates a new value for the SeriesInstanceUID (0020,000e). Other UIDs are not modified!

-gin --gen-inst-uid: dcmodify -gin file.dcm This command generates a new value for the SOPInstanceUID (0008,0018). The corresponding MediaStorageSOPInstanceUID (0002,0003) is adjustet to the new value automatically. Please note, that it's not possible to avoid this metaheader update via the -nmu option.

-nmu --no-meta-uid: dcmodify -m "SOPInstanceUID=[UID]" -nmu *.dcm This will modify the SOPInstanceUID to the given [UID], but -nmu avoids, that dcmodify adjusts the MediaStorageSOPInstanceUID in the metaheader, too.

COMMAND LINE

All command line tools use the following notation for parameters: square brackets enclose optional values (0-1), three trailing dots indicate that multiple values are allowed (1-n), a combination of both means 0 to n values.

Command line options are distinguished from parameters by a leading '+' or '-' sign, respectively. Usually, order and position of command line options are arbitrary (i.e. they can appear anywhere). However, if options are mutually exclusive the rightmost appearance is used. This behaviour conforms to the standard evaluation rules of common Unix shells.

In addition, one or more command files can be specified using an '@' sign as a prefix to the filename (e.g. @command.txt). Such a command argument is replaced by the content of the corresponding text file (multiple whitespaces are treated as a single separator) prior to any further evaluation. Please note that a command file cannot contain another command file. This simple but effective approach allows to summarize common combinations of options/parameters and avoids longish and confusing command lines (an example is provided in file share/data/dumppat.txt).

ENVIRONMENT

The dcmodify utility will attempt to load DICOM data dictionaries specified in the DCMDICTPATH environment variable. By default, i.e. if the DCMDICTPATH environment variable is not set, the file <PREFIX>/lib/dicom.dic will be loaded unless the dictionary is built into the application (default for Windows).

The default behaviour should be preferred and the DCMDICTPATH environment variable only used when alternative data dictionaries are required. The DCMDICTPATH environment variable has the same format as the Unix shell PATH variable in that a colon (':') separates entries. The data dictionary code will attempt to load each file specified in the DCMDICTPATHenvironment variable. It is an error if no data dictionary can be loaded.

COPYRIGHT

Copyright (C) 2003-2005 by Kuratorium OFFIS e.V., Escherweg 2, 26121 Oldenburg, Germany.