Performing modality transform in floating point

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
alanxz
Posts: 9
Joined: Mon, 2012-05-21, 08:37

Performing modality transform in floating point

#1 Post by alanxz »

I have a program that represents pixel data internally as floating point values. I would like to read a DICOM image, then perform the modality transform in floating point and end up with floating point pixel data.

Whats the best way to do this in DCMTK?

I've looked into starting with the DicomImage class and passing in the CIF_IgnoreModalityTransformation, then extracting the pixel data with getInterData(), then using DiMonoInputPixelTemplate<InType, double, float>() to do the modality transform. However I get lost trying to figure out what the correct way to go about creating a DiInputPixel object to feed into the DiInputPixel and DiDocument parameters of the DiMonoInputPixelTemplate constructor.

alanxz
Posts: 9
Joined: Mon, 2012-05-21, 08:37

Re: Performing modality transform in floating point

#2 Post by alanxz »

Couldn't figure out a way to do this without modifying the library code itself, so that's what I ended up doing. For the next person that stumbles upon this here's the code in question.

https://github.com/alanxz/dcmtk

You'll want the floating_internal_rep branch, which contains a single commit based on the DCMTK-3.6.1_20120512 tag.

The commit adds a CIF_UseFloatingInternalRep flag that can be passed into the various DicomImage constructors. I've only bothered modifying the dcmimgle library (did not bother with the dcmimage library), and I've only validated that it works when you construct a DicomImage object, then retrieve it using the DicomImage::getInterData(), everything else is completely untested.

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

Re: Performing modality transform in floating point

#3 Post by Michael Onken »

I did not check the code since my colleague Jörg is the main author of dcmimage/le, but many thanks for sharing and supporting the community, Alan :)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest