Can dcmodify.exe accept command line args from a file?

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

Can dcmodify.exe accept command line args from a file?

#1 Post by dave »

We are trying to modify a pixel tag, "7fe0,0010", which is 512 KB in size, in a DRR dicom file. Essentailly we want to replace the current image with a blank one, where all the values are \0's.

Trouble is this creates a command line argument string that is longer than what Windows allows (8192 characters, I believe).

Can dcmodify accept an argument list from a text file?
Are there any other methods that we can use to change this tag value?

Thanks,

David

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#2 Post by Michael Onken »

Hi Dave,

dcmodify isn't able to accept values from an input file, because it's originally not designed for changing pixel data or other binary data tags. It should be possible to extend dcmodify to support file input. If you have a unix/linux machine, you might find a shell able to use longer input lines, but I never tried that (nor wanna do so ;) ).

Another way to do such an operation you requested is the use of dcmdump and dump2dcm.

First you have to dump the orignal file to a text file:

Code: Select all

dcmdump +L +W . original.dcm > original.dump
+L lets dcmdump print long values (e.g. overlays) and +W redirects the pixel data output to a file in the given directory (here "."). The file is named "original.dcm.0.raw", IIRC.
Through "> original.dump" the rest of the dump is redirected to the file "original.dump". dcmdump automatically places a reference to the pixel data file into "original.dump".

You can modify both resulting files, especially you can change the pixel data in the raw file, too.

Now dump2dcm comes into play, using

Code: Select all

 dump2dcm original.dump > result.dcm 

You will need the "+l " option to allow dump2dcm to read lines longer than 4096 characters. Perhaps "+E" is useful, too, if there are minor errors (better: correct them in .dump file). dump2dcm automatically resolves the link to the pixel data file given in the .dump file.

Ok, this was kind of detailed and might sound laborious, but practically you can do this relatively fast.

Of course you're welcome to write a dcmodify patch and if you do, you might send it via email so we can integrate it into the next release :o

Regards,
Michael 8)

dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

#3 Post by dave »

Thanks, Michael. Your reply is very helpful to us.

Will dump2dcm.exe also do the group and item length recalulations that dcmodify.exe does?

We need to also change a few other tags with shorter values, and we will use dcmodify for this, which I guess would let us know if we've made an invalid file?

Regards,

David

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#4 Post by Michael Onken »

Hi Dave,

yes, all tools that internally use dcmdata functionality in DCMTK (and that should be all) are doing these automatic corrections, if they find wrong tag lengths or similar. Group length etc. are also recalculated by default.

Not all command line tools allow to toggle this automatic correction behaviour, but per default they are enabled. If you're not sure anyway, then you could do some simple test modifications of a file to see, whether it works as you desire. But generally you don't have to worry about these corrections.

Regards,
Michael :)

dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

#5 Post by dave »

We tried out dcmdump and dump2dcm and both perform as expected. However, we notice that dump2dcm adds tag 0002,0013 with a value of OFFIS_DCMTK_354. Can someone explain the reason for this?

David

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#6 Post by Michael Onken »

Hi, from the DICOM Dictionary:
(0002,0013) Implementation Version Name SH 1
so this is the name of the implementation, that wrote this file. In this case, you used DCMTK 3.5.4.

Regards,
Michael

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest