Create Multi Frame DICOM Image from Single Fram DICOM Image.

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Posts: 2
Joined: Mon, 2014-09-29, 09:24

Create Multi Frame DICOM Image from Single Fram DICOM Image.

#1 Post by ranjan621 » Mon, 2014-09-29, 10:19

may I know how can I create Mutiframe DICOM Image from Single frame.
It would be very nice If get some CODE.

I have tried to create 2 frameImage Image from Single frame DICOM Image.

OFCondition status = odff.loadFile("source.dcm");
DcmDataset* dataset = odff.getDataset();
int FrameCount = 2;
dataset->putAndInsertString(DCM_NumberOfFrames, "2");

Uint8 image_buffer[5000]; // 50x50 pixels x2 frames x1 byte per pixel
int m = 0;
int i=0;
for (i=0; i<50*50; i++)
image_buffer[i+m] = 0; // set all pixels to black
// frame 1
m = 2500;
for (i=0; i<50*50; i++)
image_buffer[i+m] = 255; // set all pixels to white
DcmPixelSequence *sequence = new DcmPixelSequence(DcmTag(DCM_PixelData, EVR_OB));
for (int n=0; n<FrameCount; n++)
DcmPixelItem *newItem = new DcmPixelItem(DcmTag(DCM_Item, EVR_OB));
if (newItem != NULL)
OFCondition result = newItem->putUint8Array((Uint8 *)(&image_buffer[n*FrameCount]), FrameCount);

OFCondition status = odff.saveFile(imgfilename.str().c_str(), EXS_LittleEndianExplicit);

Any solution is highly appreciable!
Thanks :)

Post Reply

Who is online

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