I've successfully loaded DICOM JPEG compressed multi-frame files and accessed
the decompressed frame buffers using a DicomImage instance. What I want to do
now is to be able to access the frame buffers without them being decompressed,
i.e. I want access to the buffers in their JPEG compressed state. Does anyone
have any ideas on how I can use DCMTK to do that?
> I've successfully loaded DICOM JPEG compressed multi-frame files and accessed
> the decompressed frame buffers using a DicomImage instance. What I want to do
> now is to be able to access the frame buffers without them being decompressed,
> i.e. I want access to the buffers in their JPEG compressed state. Does anyone
> have any ideas on how I can use DCMTK to do that?
in order to access the original JPEG compressed pixel data you cannot use the
DicomImage class. Instead, you should use the lower level dcmdata routines as
follows (assuming that the "dataset" variable already contains the DICOM data):
DcmStack stack;
/* search for PixelData element on top-level */
if (dataset->search(DCM_PixelData, stack, ESM_fromHere, OFFalse /*searchIntoSub*/).good())
{
DcmPixelData *pixelData = (DcmPixelData *)stack.top();
if (pixelData != NULL)
{
/* get pixel data sequence (if available) */
E_TransferSyntax xfer = EXS_Unknown;
const DcmRepresentationParameter *repParam = NULL;
pixelData->getOriginalRepresentationKey(xfer, rep);
if ((xfer != EXS_Unknown) && DcmXfer(xfer).isEncapsulated())
{
DcmPixelSequence *pixelSeq = NULL;
if (pixelData->getEncapsulatedRepresentation(xfer, repParam, pixelSeq).good() && (pixelSeq != NULL))
{
/* now "pixelSeq" points to the sequence of pixel items */
/* pixelSeq->card() returns the number of pixel items and */
/* pixelSeq->getItem() allows to access a particular pixel item */
}
}
}
}
In case you should have any further questions please do not hesitate to contact us directly (di...@offis.de).
Regards,
Joerg Riesmeier
OFFIS