Hi,
I am using this "PutAndInsertUint16Array" function to create the DICOM File. My DICOM attributes are 1000 -Image Width, 1000 - Image Height, 16 -Bits Per Pixel, and Number of Frames is 240 and getting Virtual memory exhaust problem. (DCMTK Version 3.5.4)
But when i change the number of frames to 220, it is working fine with out showing this virtual memory exhaust problem.
Please help us in solving the issue.
Regards,
Prakash
Virtual Memory Exhaust Problem in "PutAndInsertUint16Array" Function
Moderator: Moderator Team
-
- DCMTK Developer
- Posts: 2054
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Hi,
maybe your memory is really exhausted ?
All your frames should sum up to 1000*1000*2*240=480000000 Bytes = around 450 MegaByte. I guess you have it two times in memory, which is nearly 1 GB. Could that be a problem? If it is not grayscale but RGB data than you can multiply this with 3,ie. you have a need of 2,5-3GB of memory.
In the current snapshot versions newer to DCMTK you have a function called createValueFromTempFile which can be used in order to not having these large amounts of data in memory.
Best regards,
Michael
maybe your memory is really exhausted ?
All your frames should sum up to 1000*1000*2*240=480000000 Bytes = around 450 MegaByte. I guess you have it two times in memory, which is nearly 1 GB. Could that be a problem? If it is not grayscale but RGB data than you can multiply this with 3,ie. you have a need of 2,5-3GB of memory.
In the current snapshot versions newer to DCMTK you have a function called createValueFromTempFile which can be used in order to not having these large amounts of data in memory.
Best regards,
Michael
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
... or you could use createUint16Array() to avoid copying the pixel data - this method is already available for DCMTK 3.5.4.
Hi Jorg,
As per your suggestion we have implemented with CreateUint16Array as follows:
PixelData = new DcmPixelData(DCM_PixelData);
Uint8* Pixels = NULL;
_DcmStatus = PixelData->createUint8Array( _DcmDemographicInfo.Rows*_DcmDemographicInfo.Columns*_DcmDemographicInfo.SamplesPerPixel*_DcmDemographicInfo.NumberOfFrames,
(Uint8 *)Pixels);
if(_DcmStatus.bad())
{
if(PixelData)
{
PixelData->clear();
delete PixelData;
PixelData=NULL;
}
_DcmErrorCode=DXSDCF_ERRORINSTORINGIMAGEDATA;
_DcmErrorString = _DcmStatus.text();
return S_FALSE;
}
FILE *FilePointer = fopen((LPCTSTR)RawFilePath,"rb");
if(_DcmDemographicInfo.NumberOfFrames==0)
{
fread(Pixels,sizeof(BYTE),_DcmDemographicInfo.Rows*_DcmDemographicInfo.Columns*_DcmDemographicInfo.SamplesPerPixel, FilePointer);
}
else
{
fread(Pixels,sizeof(BYTE),_DcmDemographicInfo.Rows*_DcmDemographicInfo.Columns*_DcmDemographicInfo.SamplesPerPixel*_DcmDemographicInfo.NumberOfFrames, FilePointer);
}
But we are getting exception in JPEGLOSSY transfer sysntax that too in Choose representation function in 3.5.4 version . Can you please help me in this regard. thank you
As per your suggestion we have implemented with CreateUint16Array as follows:
PixelData = new DcmPixelData(DCM_PixelData);
Uint8* Pixels = NULL;
_DcmStatus = PixelData->createUint8Array( _DcmDemographicInfo.Rows*_DcmDemographicInfo.Columns*_DcmDemographicInfo.SamplesPerPixel*_DcmDemographicInfo.NumberOfFrames,
(Uint8 *)Pixels);
if(_DcmStatus.bad())
{
if(PixelData)
{
PixelData->clear();
delete PixelData;
PixelData=NULL;
}
_DcmErrorCode=DXSDCF_ERRORINSTORINGIMAGEDATA;
_DcmErrorString = _DcmStatus.text();
return S_FALSE;
}
FILE *FilePointer = fopen((LPCTSTR)RawFilePath,"rb");
if(_DcmDemographicInfo.NumberOfFrames==0)
{
fread(Pixels,sizeof(BYTE),_DcmDemographicInfo.Rows*_DcmDemographicInfo.Columns*_DcmDemographicInfo.SamplesPerPixel, FilePointer);
}
else
{
fread(Pixels,sizeof(BYTE),_DcmDemographicInfo.Rows*_DcmDemographicInfo.Columns*_DcmDemographicInfo.SamplesPerPixel*_DcmDemographicInfo.NumberOfFrames, FilePointer);
}
But we are getting exception in JPEGLOSSY transfer sysntax that too in Choose representation function in 3.5.4 version . Can you please help me in this regard. thank you
Who is online
Users browsing this forum: Bing [Bot] and 1 guest