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
Splitting Multiframe DICOM into single slice DICOM files
Moderator: Moderator Team
-
- Posts: 32
- Joined: Mon, 2018-11-12, 20:01
-
- DCMTK Developer
- Posts: 2505
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: Splitting Multiframe DICOM into single slice DICOM files
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.
Who is online
Users browsing this forum: Bing [Bot] and 1 guest