DVPresentationState on 16 bit image

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
paolom
Posts: 169
Joined: Tue, 2008-09-16, 15:02

DVPresentationState on 16 bit image

#1 Post by paolom »

Hi,
I use this code from the doc to attach presentation state to image data

Code: Select all

DcmFileFormat imagefile;
DcmFileFormat gspsfile;
if (imagefile.loadFile("image.dcm").good() &&
    gspsfile.loadFile("gsps.dcm").good())
{
  DVPresentationState pstate; // presentation state handler
  if (pstate.read(*gspsfile.getDataset()).good()) // parse gsps object
  {
    // attach presentation state to image data
    if (pstate.attachImage(&imagefile, OFFalse).good())
    {
      const void *pixel; // pointer to pixel data, one byte per pixel
      unsigned long width;   // width of image bitmap
      unsigned long height;  // height of image bitmap
      if (pstate.getPixelData(pixel, width, height).good())
      {
        /* do something useful with the pixel data */
      }
      pstate.detachImage(); // release connection between GSPS and image
    }
  }
}
From the doc:
pixelData in this parameter a pointer to the pixel data is returned (array of 8 bit values)
If I have a 16 bit image, I think I get a 8 bit pixel data.
How can I get a 16 bit pixel data?

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

Re: DVPresentationState on 16 bit image

#2 Post by J. Riesmeier »

As you can read in the API documentation, the DVPresentationState::getPixelData() method always returns an array of 8 bit values. This is because the DICOMscope user interface (for which the "dcmpstat" module has been developed originally) does not support more than 8 bits.

Post Reply

Who is online

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