Unsupported value for 'PhotometricInterpretation'

All other questions regarding DCMTK

Moderator: Moderator Team

Message
Author
ilia71
Posts: 22
Joined: Wed, 2016-10-19, 13:13

Unsupported value for 'PhotometricInterpretation'

#1 Post by ilia71 »

Hi,

I currently downloaded Dcmtk 3.6.0 and trying to run this simple piece of code:

Code: Select all

int main() {

	DcmRLEDecoderRegistration::registerCodecs();
	DcmFileFormat fileformat;
        if (fileformat.loadFile("test.dcm").good()) {
		DcmDataset *dataset = fileformat.getDataset();
		OFCondition a = dataset->chooseRepresentation(EXS_LittleEndianExplicit, NULL);
      if (dataset->canWriteXfer(EXS_LittleEndianExplicit)) {
			  fileformat.saveFile("test.dcm", EXS_LittleEndianExplicit);
           DicomImage bmImg(dataset, EXS_LittleEndianExplicit);
			  int b = bmImg.writeBMP("testBmp.bmp");// Trying to get the bitmap image from the first frame
		}
	}
	DcmRLEDecoderRegistration::cleanup();
    return 1;
}
After the line: DicomImage bmImg(dataset, EXS_LittleEndianExplicit); i get the message E: unsupported value for 'PhotometricInterpretation' (PALETTE COLOR)
And the following line is not properly executed (i.e. the bitmap image wasn't created).

any hint?
Last edited by ilia71 on Thu, 2016-10-20, 09:35, edited 1 time in total.

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

Re: Unsupported value for 'PhotometricInterpretation'

#2 Post by J. Riesmeier »

You have to register support for color images by adding the following line to your application (and by linking the dcmimage library to it):

Code: Select all

#include "dcmtk/dcmimage/diregist.h"     /* include to support color images */

ilia71
Posts: 22
Joined: Wed, 2016-10-19, 13:13

Re: Unsupported value for 'PhotometricInterpretation'

#3 Post by ilia71 »

Perfect!

Thank you.

ilia71
Posts: 22
Joined: Wed, 2016-10-19, 13:13

Re: Unsupported value for 'PhotometricInterpretation'

#4 Post by ilia71 »

Few more questions.
1) I noticed that when i execute

Code: Select all

fileformat.saveFile("test.dcm", EXS_LittleEndianExplicit);
, the image in the new DICOM file is Gray Scale rather then RGB as it used to be. How can i save it in RGB format?
2) How can i access DICOM's data fields like 'Frame Time Vector' , 'Heart Rate', etc. ?

Thank you

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

Re: Unsupported value for 'PhotometricInterpretation'

#5 Post by J. Riesmeier »

Re. 1) I have no idea, but is your DICOM input image RLE-compressed? Maybe, something is wrong with the encoding...

Re. 2) Use findAndGet...() on the DICOM dataset. See Example in the documentation.

ilia71
Posts: 22
Joined: Wed, 2016-10-19, 13:13

Re: Unsupported value for 'PhotometricInterpretation'

#6 Post by ilia71 »

I have also tried to decode JPEG-LS image of 1.2.840.10008.1.2.4.70 transfer syntax UID by performing:

Code: Select all

DJLSDecoderRegistration::registerCodecs(); // register JPEG-LS codecs
But it went unsuccessfully, i.e. the condition:

Code: Select all

if (dataset->canWriteXfer(EXS_LittleEndianExplicit))
returns false.
Am i doing something wrong?

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

Re: Unsupported value for 'PhotometricInterpretation'

#7 Post by J. Riesmeier »

What does the logger show? You could also try the respective command line tool, i.e. dcmdjpls/dcml2pnm or dcmdrle/dcm2pnm (probably with debug mode enabled).

ilia71
Posts: 22
Joined: Wed, 2016-10-19, 13:13

Re: Unsupported value for 'PhotometricInterpretation'

#8 Post by ilia71 »

i tried

Code: Select all

DJDecoderRegistration::registerCodecs();
and it worked just fine!

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

Re: Unsupported value for 'PhotometricInterpretation'

#9 Post by J. Riesmeier »

Then the image is not JPEG-LS compressed but with one of the conventional JPEG compression schemes. The transfer syntax UID "1.2.840.10008.1.2.4.70" also refers to JPEG Lossless and not to JPEG-LS.

ilia71
Posts: 22
Joined: Wed, 2016-10-19, 13:13

Re: Unsupported value for 'PhotometricInterpretation'

#10 Post by ilia71 »

Yes, it was my mistake.

ilia71
Posts: 22
Joined: Wed, 2016-10-19, 13:13

Re: Unsupported value for 'PhotometricInterpretation'

#11 Post by ilia71 »

Hi,

I have a small question regarding data extraction from the dataset (of a type DcmDataSet*).
In my code i was using the following two lines:

Code: Select all

dataSet->findAndGetUint32(DCM_RegionLocationMinX0, oMetaInfo.RegMinX0);
dataSet->findAndGetUint16(DCM_SamplesPerPixel, oMetaInfo.SamplesPerPixel);
While the second line worked just fine(placed the correct value inside SamplesPerPixel, which is a member
of a type Uint16 inside a struct called oMetaInfo), the first line didn't(placed zero inside RegMinX0 as if Uint32
is not the right VR for the tag key DCM_SamplesPerPixel although it is!).

I hope my question was clear,
Thank you

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: Unsupported value for 'PhotometricInterpretation'

#12 Post by Michael Onken »

Hi,

i would be surprised if this is really a bug in DCMTK. Please check that the tag exists in your dataset, that your target variable is of type Uint32, and also maybe check the return value (OFCondition). If you have time, use the debugger to see where the error occurs.

Thank you,
Michael

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

Re: Unsupported value for 'PhotometricInterpretation'

#13 Post by J. Riesmeier »

I guess the returned status is "tag not found": RegionLocationMinX0 is usually contained in the SequenceOfUltrasoundRegions and not part of the top-level dataset, so you either have to retrieve the sequence element first or set the "searchIntoSub" parameter of your findAndGetUint32() call to OFTrue.

ilia71
Posts: 22
Joined: Wed, 2016-10-19, 13:13

Re: Unsupported value for 'PhotometricInterpretation'

#14 Post by ilia71 »

Worked great! thank you

ilia71
Posts: 22
Joined: Wed, 2016-10-19, 13:13

Re: Unsupported value for 'PhotometricInterpretation'

#15 Post by ilia71 »

Hi,

Just one more thing.
After i decompressed the data set using:

Code: Select all

dataSet->chooseRepresentation(EXS_LittleEndianExplicit, NULL);
how can i extract a single frame (without initializing an instance of DicomImag, which is not so efficient considering the fact i need only the first frame
while the entire Image might be quite big)?

Thank you

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest