DcmImage->GetOutPut in 16 bits

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
VHonnet
Posts: 7
Joined: Mon, 2005-01-10, 17:11

DcmImage->GetOutPut in 16 bits

#1 Post by VHonnet »

Hello,

I have a problem to get 16 bits pictures of Dicom files. The method getOutPutData of DcmImage gives back an error. How should I do ?
Otherwise, the getOutputData gives also an error while trying to get 8 bits rendering of a 16 bits Dicom file. Is there hier something special to do ?

Thanks a lot in advance !

Thomas Wilkens
DCMTK Developer
Posts: 117
Joined: Tue, 2004-11-02, 17:21
Location: Oldenburg, Germany
Contact:

#2 Post by Thomas Wilkens »

There is an example in DCMTK's documentation (file dcmimage/docs/dcmimage.dox):

Code: Select all

#include "diregist.h"   /* required to support color images */
/* ... */
DicomImage *image = new DicomImage("test.dcm");
if (image != NULL)
{
  if (image->getStatus() == EIS_Normal)
  {
    Uint8 *pixelData = (Uint8 *)(image->getOutputData(8 /* bits per sample */));
    if (pixelData != NULL)
    {
      /* do something useful with the pixel data */
    }
  } else
    cerr << "Error: cannot load DICOM image (" << DicomImage::getString(image->getStatus()) << ")" << endl;
}
delete image;
In order to get 16-bit pixel data, use an Uint16 pointer and pass (int)16 as a parameter to getOutputData.

Post Reply

Who is online

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