improve the performance while breaking Multiframe file

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
angad
Posts: 112
Joined: Thu, 2010-02-18, 09:54

improve the performance while breaking Multiframe file

#1 Post by angad »

Hi All,

I am trying to break US modality's multiframe Dicom file into single frame dicom files, which contains 522 frames. Earlier i am loading one frame at a time by passing fCount as 1 ,it was taking 31 secs break all frames into single frame Dicom files.

Code:
u_int PartialFetchCount = 1;
DicomImage *image = new DicomImage(dicomFileLocation.c_str(), CIF_UsePartialAccessToPixelData, 0, PartialFetchCount /* fcount */);


if (image->getStatus() == EIS_Normal)
{
OFCondition status;
do
{
//by using writeframetodataset and saveImage() API's we are storing in a dicom file.

} while (image->processNextFrames());
delete image;
delete cDicom;
return true;
}
else
{
RAD_LOG_CRITICAL("Error occured while loading the DicomImage() API. Status returned is : " << image->getStatus());
delete cDicom;
return false;
}
My intention is to reduce the breaking time as much as we can.
I saw somewhere in the forum, by loading the n number of frames at a time ( by increasing the fCount value). we can reduce the break Time.
after that i increased that fCount to 100 then also i am not experiencing any improvement( still it is taking 31 secs only).

Code:
u_int PartialFetchCount = 100;
DicomImage *image = new DicomImage(dicomFileLocation.c_str(), CIF_UsePartialAccessToPixelData, 0, PartialFetchCount /* fcount */);

u_int frameCount = 0;
if (image->getStatus() == EIS_Normal)
{
OFCondition status;
do
{
u_int frameCount = image->getFrameCount();
for(i=0;i<frameCount ;i++)
{
//by using writeframetodataset and saveImage() API's we are storing in a dicom file.
}
} while (image->processNextFrames());
delete image;
delete cDicom;
return true;
}
else
{
RAD_LOG_CRITICAL("Error occured while loading the DicomImage() API. Status returned is : " << image->getStatus());
delete cDicom;
return false;
}

could you please help me to improve the performance?

I am waiting for your reply. :roll:

Thanks,
Angad

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

Re: improve the performance while breaking Multiframe file

#2 Post by J. Riesmeier »

In my opinion, the DicomImage class is not the right candidate for your use case (breaking DICOM multi-frame images into DICOM single-frame images) because this class is intended for rendering/visualizing DICOM images. I would rather work on the raw pixel data using the lower level API provided by the dcmdata module.

Post Reply

Who is online

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