DiPluginFormat and pixel data

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
mhavu
Posts: 15
Joined: Wed, 2005-11-23, 16:23
Location: Jyväskylä, Finland

DiPluginFormat and pixel data

#1 Post by mhavu »

Hi,

I use a class derived from DiPluginFormat to act as a bridge between my application and DICOM images. I'm trying to read a bunch of 16-bit signed velocity-encoded MRI images, where the pixel values vary e.g. from -100 to 100. If I read these with DiImage::getOutputData(), the pixel values become what I gather to be two's complements of what they are supposed to be (they map to the range -32768 ... -32668, 32668 ... 32767).

Code: Select all

int myplugin::write(
  DiImage* image,
  FILE* stream,
  const unsigned long frame) const
{
    int StoredBits = image->getBits();
    const void * data = image->getOutputData(0, StoredBits, 0);

    // do stuff with data

    return 1;
}
Does anyone have a clue why this happens? I know that DicomImage::getOutputData() does various transformation on the pixel data to render the image, but how about DiImage::getOutputData()? I could always read the raw pixel data with findAndGetSint16Array() without using the plugin, but I'd like to understand what happens here.

- Marko

mhavu
Posts: 15
Joined: Wed, 2005-11-23, 16:23
Location: Jyväskylä, Finland

Update

#2 Post by mhavu »

I forgot to post an update, but I found out later on that this has actually nothing to do with the DiPluginFormat. The mapping happens with both DicomImage::getOutputData() and DiImage::getOutputData() regardless of whether DiPluginFormat is used or not. I'd still like to know why.

- Marko

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1493
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#3 Post by Marco Eichelberg »

That's because the dcmimage library is intended for image display, and all display devices I know only handle unsigned pixel values of a certain bit depth. getOutputData will always implicitly convert pixel data to unsigned and change the bit depth as needed.
The next release of the toolkit will have a method

Code: Select all

const DiPixel *DicomImage::getInterData()
which is probably rather what you need, but this does not yet exist in 3.5.3 if I remember correctly.

mhavu
Posts: 15
Joined: Wed, 2005-11-23, 16:23
Location: Jyväskylä, Finland

#4 Post by mhavu »

Indeed. Thanks. Will the new getInterData method apply the modality LUT or not?

- Marko

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#5 Post by Jörg Riesmeier »

Usually, it does but this can be changed if required using flag CIF_IgnoreModalityTransformation in the constructor.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 0 guests