Heesung Yang

Linux command - dcmodify / modify dicom files

  • DCMTK version: 3.6.5
  • Sample DICOM file name: sample.dcm

Basic Options

~$ dcmodify -imt -nb -ep -ea "(0018,1020)" "${FILE}"
~$ dcmodify -nb -i "(0018,1020)=Myhome" "${FILE}"
~$ dcmodify -nb -m "(0018,1020)=Myhome" "${FILE}"
  • -i : insert tag
  • -e : delete tag
  • -m : modify tag
  • -nb : no backup
  • -imt : ignore missing tag
  • -ep : erase all private tags
  • -ea : erase all matched tags

Insert tag

Single tag

~$ dcmodify -i "ImageLaterality=L" sample.dcm

Sequence tag

# (0028,3010)     SQ (Sequence with explicit length #=1)      # 8246, 1 VOILUTSequence
#   (fffe,e000)   na (Item with explicit length #=3)          # 8238, 1 Item
#     (0028,3002) US 4096\0\12                                # 6,    3 LUTDescriptor
#     (0028,3003) LO [Inserted string2]                       # 16,   1 LUTExplanation  <<< Add this line

# available in five forms
~$ dcmodify -i "VOILUTSequence[0].LUTExplanation=Inserted string" sample.dcm
~$ dcmodify -i "(0028,3010)[0].LUTExplanation=Inserted string" sample.dcm
~$ dcmodify -i "(0028,3010)[0].0028,3003=Inserted string" sample.dcm
~$ dcmodify -i "(0028,3010)[0].(0028,3003)=Inserted string" sample.dcm
~$ dcmodify -i "0028,3010[0].0028,3003=Inserted string" sample.dcm

Delete tag

~$ dcmodify -e "(0028,3010)" sample.dcm
# or
~$ dcmodify -e "VOILUTSequence" sample.dcm

Modify tag

~$ dcmodify -m "ImageLaterality=R" sample.dcm