1
votes

I'm working with DICOM images and use DCMTK to make some process.

My problem here is that I have to retrieve only certain tags of batch of images. But the process take too long.

I'm using dcmdump -M -L +P '0010,0020' +P '0010,0010

  • -M do not load very long values (e.g. pixel data)
  • -L print long tag values shortened (default)
  • +P print the textual dump of tag, this option can be specified multiple times

But the "dumping" of a single file take ~1sc. It's because all tags are still loaded but then the +P is searching through all tags.

I only have a few tags to retrieve. Is there any possibilities to only load certain specific tags to reduce the time necessary to dump a file?

Maybe DCMTK is not the right tool to use. I'm open to everything.

1
You mean it takes 1 second per file? I cannot confirm this. It's true that all data elements are parsed by dcmdump but large values are definitely not loaded if option -M and -L are used. Since you referred to "batch of images": Do you call dcmdump multiple times or do you use the "recursive seach" mode...?J. Riesmeier
Indeed it takes 1sc per file. And yes I use dcmdump multiple time, one per fileAtnaize
Then this long time is probably used for loading the dcmdump binary? Of course, you can also start dcmdump with multiple filenames or use the recursive batch mode, e.g.: dcmdump +P 10,10 -M -L +r +sd . +fo +Fs -q This should give you a list with the Patient's Name of all DICOM files stored in the current directory (and below).J. Riesmeier
@J.Riesmeier, the problem is that I want to do it file per file because I order them in a file structure. I don't want to process by batch except if there is a magical function that order the way I need ;)Atnaize
You could add all files to be dumped to the command line, i.e. in the desired order :) Of course, you should make sure that the maximum length of the command line (depends on your shell) is not exceeded. By the way, which operating system do you use? The program start time could possibly be improved by using the built-in data dictionary. See: support.dcmtk.org/docs/file_datadict.htmlJ. Riesmeier

1 Answers

3
votes

The gdcm package has a command line tool to do exactly what you want

http://gdcm.sourceforge.net/html/gdcmscanner.html

In order to display all the values for Patient Name (0010,0010) for files in the current directory.

gdcmscanner -t 10,10 -d . -p

It only loads the bits you ask for. It is fast.