[SOLVED] GDCMIO without image data element

Hello just a short question for reassurance:

Does the gdcmIO can write a dicom without an actual image (e.g. for an RTStruct)?

The documentation states:
“ImageIO class for reading and writing DICOM V3.0 and ACR/NEMA 1&2 uncompressed images. This class is only an adaptor to the GDCM library.”

And in the github entry for gdcmIO I cannot see a possibility to write an image without the data element.

As an exended question:
Are the gdcm module provided by the ITK third party module as powerful as the system_gdcm or it is a light version of the system_gdcm?

What are the caveats/drawbacks to use the system_gdcm in ITK?

Thanks in advance,
Gordian

@mathieu.malaterre should be able to answer those questions authoritatively.

You can use GDCM to read any DICOM IOD. However, to be able to use parallel contours stored in an RTSTRUCT IOD you need to create a surface mesh or image. This is a very complex task - see some of the difficulties (keyholes, branching, end-capping, varying slice spacing) described in this short paper).

A quite sophisticated and very thoroughly tested RTSTRUCT importer is available in 3D Slicer, in SlicerRT extension. It can read RTSTRUCT and save it as a set of planar contours (native representation), closed surface (smoothly interpolated between planar contours), binary labelmap, or fractional labelmap. SlicerRT can read/write not just RTSTRUCT but RTDOSE, RTPLAN, RTIMAGE IODs. You can do the conversion for lots of data sets in one batch. If you don’t want to depend on 3D Slicer in your workflow then you can also just any part of the implementation and copy to your project.

1 Like

@Gordian GDCMImageIO is solely restricted to ‘Image’ type (= DataSet with Pixel Data element) . While GDCM does support a large portion of the DICOM standard, GDCMImageIO was designed only to decode Pixel Data buffer (hence the use ot gdcm::ImageReader). You’ll need to use gdcm (or system gdcm if you prefer) directly (in particular gdcm::Reader / gdcm::Writer) to handle the wider variety of DICOM IODs.

1 Like

Hello Andras,

thank you for your suggestions. I have tried slicer with the RT extension. To create an image i rely on the itk::spatialobjecttoimagefilter from the ITK and use it on every slice. This works fine for the moment.
If I need another way to do, I will have a look at the source of slicerrt impoirt export classes.
I am not sure if I can use the slicerrt for a custom programm that does not need slicer (because i do not need the visualization overhead).

As far I have seen the dicomIO in slicerrt is based on dcmtk? Is there a gdcm version?

Yes, simple methods work fine for simple shapes (no keyhole technique used, etc.) and certain use cases (when you don’t need to show the original contour in orthogonal views or lossless display of the original shape in 3D, etc.).

SlicerRT is commonly used for batch conversion of many RTSTRUCT IODs to binary images, no GUI, just command-line - see an example here.

ITK supports DCMTK, too, so if you want to reuse the import/conversion code then you could rely on that. Porting the logic to GDCM would not be complicated either.

1 Like