DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Thu, 2017-11-23, 13:59

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sat, 2017-07-29, 15:32 
Offline

Joined: Wed, 2014-01-08, 16:20
Posts: 7
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


Top
 Profile  
 
PostPosted: Sat, 2017-07-29, 21:24 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1874
Location: Oldenburg, Germany
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.


Top
 Profile  
 
PostPosted: Sat, 2017-07-29, 22:37 
Offline

Joined: Wed, 2014-01-08, 16:20
Posts: 7
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


Top
 Profile  
 
PostPosted: Mon, 2017-07-31, 18:56 
Offline

Joined: Wed, 2014-01-08, 16:20
Posts: 7
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


Top
 Profile  
 
PostPosted: Wed, 2017-08-02, 10:33 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1874
Location: Oldenburg, Germany
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group