CIF_UseAbsolutePixelRange and conversions

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
rickf
Posts: 16
Joined: Wed, 2014-01-08, 16:20

CIF_UseAbsolutePixelRange and conversions

#1 Post by rickf »

Hi,

I'm using DicomImage() to create a volume from slices.

I find that for some images, DicomImage() converts the data to 8 bit from 16, even though the file is 16 bits. ( tracing through the code it seems to think it needs 17 bits for the representation, which is strange)

I found that if I used the CIF_UseAbsolutePixelRange then sometimes it converts the data to SInt32.

Is there a way to get back the data without a size change on the number of bits?

Thanks

Rick

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

Re: CIF_UseAbsolutePixelRange and conversions

#2 Post by J. Riesmeier »

The internal representation of the pixel data does not only depend on the value of BitsStored but also on the Modality LUT transformation and the value of PixelRepresentation. Why do you care about the internal representation at all? The purpose of the DicomImage class is visualization that means you should mainly (only) use the rendered output.

rickf
Posts: 16
Joined: Wed, 2014-01-08, 16:20

Re: CIF_UseAbsolutePixelRange and conversions

#3 Post by rickf »

I'm reading slices and building a volume in VTK, and if some of the slices come in at a different pixel width, it might save a little memory but it's not really helpful cause I have to rescale them

rickf
Posts: 16
Joined: Wed, 2014-01-08, 16:20

Re: CIF_UseAbsolutePixelRange and conversions

#4 Post by rickf »

So it seems that if I want the pixels "rendered" with the LUT I should do:


DicomImage * di = new DicomImage(path.c_str(), flags);
size_t sizeInBytes = di->getOutputDataSize();

void * bits = malloc(sizeInBytes);

di->getOutputData(buffer, sizeInBytes, bitsStored);

But I read:

/**render pixel data and output to given memory buffer.
* apply VOI/PLUT transformation and (visible) overlay planes.
* output data is always padded to 8, 16, 32, ... bits (bits allocated).
* Supported output color models: Monochrome 2 for monochrome images and RGB
* (or YCbCr_Full if flag CIF_KeepYCbCrColorModel is set) for color images.
* The rendered pixel data is always unsigned.



It says the data is unsigned and I would like to have HU units in a signed int16.


So I'm confused as to the best approach. I'm reading each slice and copying them into a VTK image for volume display.

Thanks

Rick

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

Re: CIF_UseAbsolutePixelRange and conversions

#5 Post by J. Riesmeier »

Right, the rendered pixel data returned by getOutputData() is always unsigned. Hounsfield Units, i.e. the pixel data after the Modality LUT transformation has been applied, are only available internally.

Post Reply

Who is online

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