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
Can dcmodify.exe accept command line args from a file?
Moderator: Moderator Team
-
- DCMTK Developer
- Posts: 2049
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
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:
+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
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
Regards,
Michael
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
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
Regards,
Michael
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
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
-
- DCMTK Developer
- Posts: 2049
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
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
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
-
- DCMTK Developer
- Posts: 2049
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot] and 1 guest