Splitting Multiframe DICOM into single slice DICOM files

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
artemmikheev
Posts: 32
Joined: Mon, 2018-11-12, 20:01

Splitting Multiframe DICOM into single slice DICOM files

#1 Post by artemmikheev »

Hi,
I am trying to split Multiframe DICOM into single-slice DICOM files.
Seems like all is working well in my code, but it is very slow for very large
files (3680 frames).
Bottleneck seems to be in extracting and copying Pixel data:

I use the following code:

// Getting pixel data....
DicomImage** ImgArr;
....

for ( int fi=0; fi<NF; fi++ )
ImgArr[fi] = new DicomImage((DcmObject*)SourceDataset,Tsyntax,0,unsigned long(fi),unsigned long(1)));

.......
.........

// Setting pixel data...
for ( int fi=0; fi<NF; fi++ ) {
const DiPixel *obp = ImgArr[fi]->getInterData();
int Nbypp = GetBytesPerPix( obp->getRepresentation());
PBYTE pixdata = PBYTE(obp->getData());
int pixlng = obp->getCount();
TargetDataSetArr[fi]->putAndInsertUint8Array(DCM_PixelData,pixdata,pixlng*Nbypp );
}


Is there a more efficient way in terms of speed (memory is less important)?
Also, "Getting data" part is NOT thread safe, while "Setting data" IS thread-safe.

Thank you for any advice.

-Artem

J. Riesmeier
DCMTK Developer
Posts: 2503
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Splitting Multiframe DICOM into single slice DICOM files

#2 Post by J. Riesmeier »

The purpose of the DicomImage class is rendering/visualization of DICOM images. If I were you, I would use a lower level API for extracting the pixel data from the DcmDataset instance, depending on whether the pixel data is compressed or uncompressed.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest