I want to decompress a DICOM file like in this example http://support.dcmtk.org/docs/mod_dcmjpeg.html
But my problem is that I don't want to load a file.
I have an array which inside there are the PixelData values Compressed. I have tried in this way but doesn't work.
Code: Select all
DJDecoderRegistration::registerCodecs();
DJEncoderRegistration::registerCodecs();
DcmFileFormat fileformat;
DJ_RPLossless param_lossless;
DcmDataset *pDataset = fileformat.getDataset();
pDataset->chooseRepresentation(EXS_JPEGProcess14SV1, ¶m_lossless);
BYTE* pBufferImg = (BYTE*)pArray->ImgDicom.GetAt(0); //here I have my PixelData
//I put it into my dataset
pDataset->putAndInsertUint8Array(DCM_PixelData, pBufferImg, pArray->NumByteImg);
//decompress
OFCondition status = pDataset->chooseRepresentation(EXS_LittleEndianExplicit, NULL); //status is OK
...
//add all the tags like Rows, Columuns, BitStored, etc
...
if (pDataset->canWriteXfer(EXS_LittleEndianExplicit))
{
fileformat.saveFile("test.dcm", EXS_LittleEndianExplicit);
}
DJDecoderRegistration::cleanup(); // deregister JPEG codecs
DJEncoderRegistration::cleanup();