Dear Marco
Thank you very much for the reply.
new DcmPixelData(DcmTag(DCM_PixelData, EVR_UL))
I changed this to
Code: Select all
DcmPixelData *newPixelData = new DcmPixelData(DCM_PixelData);
The insert method should never be explicitly called for class DcmPixelData.
And I removed the code
Code: Select all
dataset->insert(newPixelData, OFTrue;
newPixelData->insert(sequence);
OFstatic_cast(DcmPixelData *, newPixelData)->putOriginalRepresentation(EXS_Unknown, NULL, sequence);
for (int n=0; n<FrameCount; n++)
{
DcmPixelItem *newItem = new DcmPixelItem(DcmTag(DCM_Item, EVR_OB));
if (newItem != NULL)
{
sequence->insert(newItem);
/* put pixel data into the item */
OFCondition result = newItem->putUint8Array((Uint8 *)image_buffer, sx*sy*3);
}
}
fileformat.saveFile("c:\\test.dcm");
And added the code
Code: Select all
DJEncoderRegistration::registerCodecs();
DJ_RPLossless params; // codec parameters, we use the defaults
// this causes the lossless JPEG version of the dataset to be created
dataset->chooseRepresentation(EXS_JPEGProcess14SV1TransferSyntax, ¶ms);
/**/
E_TransferSyntax xfer = DcmXfer(EXS_JPEGProcess14SV1TransferSyntax).getXfer();
DcmPixelSequence *sequence = new DcmPixelSequence(DcmTag(DCM_PixelData, EVR_OB));
// newPixelData->insert(sequence);
OFstatic_cast(DcmPixelData *, newPixelData)->putOriginalRepresentation(xfer, NULL, sequence);
for (int n=0; n<FrameCount; n++)
{
DcmPixelItem *newItem = new DcmPixelItem(DcmTag(DCM_Item, EVR_OB));
if (newItem != NULL)
{
sequence->insert(newItem);
/* put pixel data into the item */
OFCondition result = newItem->putUint8Array((Uint8 *)image_buffer, sx*sy*3);
}
}
missing the offset table
I would like to know,in the function
Code: Select all
DJEncoderRegistration::registerCodecs()
there is a default argument
pCreateOffsetTable
Default value is TRUE and by using the call of this function will internally create Off set table, am I right?
But after including these codes chnages also doesn't make any difference.
Could you please provide a sample program on the correct usage of these classes?
Thanks and Regards
Alvin