0
votes

I need to read the raw measurement data from DICOM files into 2D double-arrays using C++. It becomes clear that DICOM is actually a rather extensive file format, and I tried to use the DCMTK library but couldn't even compile it successfully.

Since I do not need all the features DICOM offers (almost none), I would like to know if there are easy to use/install libraries out there (probably really limited in their functionality) that can load a DICOM file for me into a double-array. It would also be great, if this was a header-only solution I could simply include, instead of something I have to be able to compile first.

I am currently working on a Win64 machine, but right now my C++ code is platform independent and I would like to keep it that way.

If what I am asking is actually not available I would also accept a (reference to a) very good step-by-step installation description of one of the more complicated libraries out there as 'the easiest way'.

1
You might want to have a look at the (precompiled) DCMTK tools called dcmdump (convert header elements to structured file) and dcm2xml (same but produces XML output. Boh of them provide various options to customize the output.kritzel_sw
I like @kritzel_sw's idea. You could pipe the output into your app and filter out the values you're looking for quite readily. There's also Grass Root Dicom's version called gdcmdump which you could use.john elemans

1 Answers

2
votes

There is no open-source header-only C/C++ library for dealing with DICOM. You may want to dig into:

  1. GDCM
  2. DCMTK

You can have a loop at the simpliest API in GDCM: gdcm::ImageReader, see here.

If you are using python, GDCM offers a python binding, and you can simply import the image array as a numpy array (see here).

If you are not afraid of using VTK, there is also vtkDICOMImageReader or vtk-dicom.