first of all, I am a complete newbie to the DICOM-Toolkit, so I apologize if what I am trying to do is not..... "conform" Basically I want to read the raw pixel data of a JPEG lossless compressed image for reading only -- I do not want to modify the data, and I don't want to decompress the data.
Here's the piece of code with which I try to achieve my goal:
Code: Select all
DcmFileFormat format;
OFCondition cond;
cond = format.loadFile("testfile.dcm");
if(cond.bad())
return FAILURE;
DcmDataset *dcmDataset = format.getDataset();
const Uint16 *pPixels = NULL;
cond = dcmDataset->findAndGetUint16Array(DCM_PixelData, pPixels);
if(cond.bad())
return FAILURE;
if(NULL == pPixels)
return FAILURE;
FYI: In case of an error I do not just return; there is some error handling and log output, but I stripped it here for a better viewing.
Can anyone tell me where the error is in the above piece of code? Is there anything I should know about when handling compressed pixel data (besides the de-/encoders when actually de-/compressing the images, I am aware of those)?
Any help is very much appreciated. Thanks in advance