Suppressing DCMTK Errors

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
michalp
Posts: 6
Joined: Mon, 2018-07-09, 14:11

Suppressing DCMTK Errors

#1 Post by michalp »

Hello,

I hope this is the right place to ask this question. I apologize if not.

I am building some software based on DCMTK. For reference, I'm using some external software for viewing DICOM files.
I have a problem with reading images, that do not contain some metadata. I use 3D Slicer 4.10 (https://www.slicer.org/), which is based on DCMTK (and other libraries, but I set options to use only DCMTK). With 3D slicer I am able to open and view dcm files that I cannot using plain DCMTK.

I got this error messages from DCMTK:

Code: Select all

W: DcmMetaInfo: No Group Length available in Meta Information Header
E: mandatory attribute 'PixelRepresentation' is missing
E: one or more mandatory attributes are missing in image pixel module
Is there a way to suppress/bypass errors in DCMTK, so that I could read images from corrupted* files? 3D Slicer can read those images so I guess there is a way to read them via DCMTK (as 3D Slicer uses it).


Thanks in advance for your response,
Michal

*corrupted == with missing mandatory attributes, incompatible with DICOM standard.

J. Riesmeier
DCMTK Developer
Posts: 2504
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Suppressing DCMTK Errors

#2 Post by J. Riesmeier »

I guess Slicer does not use the DicomImage class but accesses the Pixel Data element directly.

Apart from that, the DICOM image file seems to be invalid since mandatory information is missing. So, who created the image?

michalp
Posts: 6
Joined: Mon, 2018-07-09, 14:11

Re: Suppressing DCMTK Errors

#3 Post by michalp »

Apart from that, the DICOM image file seems to be invalid since mandatory information is missing. So, who created the image?
It was generated by Mathematica via "Export" functionality for DICOM files.

So there is no way to read files with missing mandatory* information via DCMTK?


* Yes, I know it's in contradiction to definition of "mandatory" :)

J. Riesmeier
DCMTK Developer
Posts: 2504
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Suppressing DCMTK Errors

#4 Post by J. Riesmeier »

Of course there is, but the DicomImage class does not process images where mandatory attribute are missing, at least those that are needed for rendering the pixel data. If you still want to use this class, you would have to add the missing data elements in advance.

You should also inform the Mathematica people that their "Export" function creates invalid (non-standard conformant) DICOM images.

michalp
Posts: 6
Joined: Mon, 2018-07-09, 14:11

Re: Suppressing DCMTK Errors

#5 Post by michalp »

J. Riesmeier wrote:Of course there is, but the DicomImage class does not process images where mandatory attribute are missing, at least those that are needed for rendering the pixel data. If you still want to use this class, you would have to add the missing data elements in advance.
Okay, so the only way to deal with missing attributes (PixelInterpretation etc) is to fill them manually (with some default value? How?) or to handle PixelData separately, without using DicomImage?

J. Riesmeier wrote:You should also inform the Mathematica people that their "Export" function creates invalid (non-standard conformant) DICOM images.
Mathematica people are informed (I work here). I am developing new Import/Export for DICOM.

J. Riesmeier
DCMTK Developer
Posts: 2504
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Suppressing DCMTK Errors

#6 Post by J. Riesmeier »

Okay, so the only way to deal with missing attributes (PixelInterpretation etc) is to fill them manually (with some default value? How?)
If there would be a default value for PixelRepresentation, it would be easy for the DicomImage class to use this value if the data element is missing in the DICOM dataset. However, this is not the case. In my opinion, it would also be "out of scope" for the DicomImage class to "guess" the correct value based on other data element values (such as SOP Class and Modality LUT). Such heuristics should be implemented on a higher level of abstraction, e.g. on application level.

Of course, there are other image-related DICOM attributes that are not that critical and, in fact, the DicomImage class contains workarounds to deal with such attributes being absent in the dataset or having a wrong value.
Mathematica people are informed (I work here). I am developing new Import/Export for DICOM.
... then you should also fix the missing group length element in the meta information header, which is also very critical. Starting with version 3.5.4, DCMTK is able to read such corrupted DICOM files under certain conditions but other DICOM toolkits will probably reject such files.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest