2

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.

Atnaize
  • 1,766
  • 5
  • 25
  • 54
  • 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 May 09 '18 at 15:23
  • Indeed it takes 1sc per file. And yes I use dcmdump multiple time, one per file – Atnaize May 09 '18 at 19:00
  • 1
    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 May 10 '18 at 09:31
  • @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 May 14 '18 at 10:49
  • 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: https://support.dcmtk.org/docs/file_datadict.html – J. Riesmeier May 14 '18 at 14:52

1 Answers1

5

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.

  • It seems that is not feasible for a single file but more for a directory / many directories. Have you some experience with this tool? – Atnaize May 09 '18 at 14:09
  • yes, I have used dcmtk and gdcm command line tools. your question said 'images', so I assumed you wanted multiple files. I have not used recent builds, but `gdcmdump` used to be much faster than `dcmdump` from dcmtk. – ColonelFazackerley May 09 '18 at 14:32