Is this the correct way of reading the compressed pixel data

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
helioars
Posts: 14
Joined: Mon, 2010-06-14, 11:46

Is this the correct way of reading the compressed pixel data

#1 Post by helioars »

I have been trying to read the Compressed Image pixel data JPEG 2000 format. As compressed data is stored in dicom pixel sequence, i have read the dicom pixel sequence data as follows :

DcmXfer xferSyn(dataset->getOriginalXfer());
bool isEncapsulated = xferSyn.isEncapsulated();
DcmElement *delem = NULL;
if (isEncapsulated && dataset->findAndGetElement(DCM_PixelData, delem, OFFalse).good())
{
OFCondition status = EC_IllegalCall;
DcmPixelData *dpix = OFstatic_cast(DcmPixelData *, delem);

/* get pixel data sequence (if available) */
E_TransferSyntax xfer = EXS_Unknown;
const DcmRepresentationParameter *param = NULL;
dpix->getOriginalRepresentationKey(xfer, param);

DcmPixelSequence *pixSeq = new DcmPixelSequence(DcmTag(DCM_PixelData, EVR_OB));
status = dpix->getEncapsulatedRepresentation(xfer, param, pixSeq);
unsigned long nCount = pixSeq->card();
for(unsigned long indx = 0; indx < nCount ; indx++)
{
status = pixSeq->getItem(pixItem, 1);
int nFragementLength = pixItem->getLength();
if(status.good())
{
// Dump In Memory
}
}

I have got dicom pixel item from the dicom pixel sequence. but, i am not being able to verify whether the compressed pixel data is being correctly stored in the dicompixelitem or not. Is there any method of checking the pixel data being stored is correct or not.

Also, the dicom image ( JPEG 2000 format compressed image data file being loaded) is 167586 bytes.
In above code, nCount = pixSeq->Card is 2.. and for each sequence nFragementLength is 165488 bytes.
So, for two sequence nFragementLength is 330976 bytes. Is this correct too..

Am i on the correct path of coding... can anybody put some light on this matter...
Thanks..

Post Reply

Who is online

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