Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, March 16, 2010 2:26:15 AM(UTC)

Snyx  
Snyx

Groups: Registered
Posts: 6


I have Leadtools v14.5 Imaging Suite (Licensed) and already tested with Leadtools v16.5 Imaging Suite 60 Day Fully Functional Evaluation and the result is the same.

In the application, i have to load 12 DICOM (MG) of 70MB each.

Application : 80 Mo
DICOM : 840 Mo
Windows : 400 Mo
Total : 1320 Mo in memory and i have 2Go.

11 images are loaded successfully but the last returns code 2

So why the function GetImage() returns code 2 (DICOM_ERROR_MEMORY) ?

My source code :

EnumLoadImageResult LoadFromLeadToolsDicom(CString strFileName)
{

LDicomDS ds;
ds.LoadDS(strFileName.GetBuffer(0), 0);

pDICOMELEMENT pElementPixelData = ds.FindFirstElement(NULL, TAG_PIXEL_DATA, TRUE);

DICOMIMAGE Info;
ds.GetInfoImage(pElementPixelData, &Info, 0);

pBITMAPHANDLE pBitmap;
pBitmap->uStructSize = sizeof(BITMAPHANDLE);
pBitmap->Order = Info.bGray ? ORDER_GRAY : ORDER_RGB;

int nRet = ds.GetImage(pElementPixelData, pBitmap, pBitmap->uStructSize, nFrameIndex, Info.nBitsPerPixel, Info.bGray ? ORDER_GRAY : ORDER_RGB, NULL, NULL, NULL);

if (nRet == DICOM_ERROR_MEMORY)
{
return LoadMemoireInsufisante;
}
else if (nRet != DICOM_SUCCESS)
{
return LoadErreurDICOM;
}
...
return LoadOK;

}


"Note that I simplified the function to better target GetImage ()"

thanks for reply.



i'm going to try with more DICOM images this afternoon and see what happens ...
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, March 16, 2010 4:20:49 AM(UTC)

Snyx  
Snyx

Groups: Registered
Posts: 6


With 18 DICOM images :

11 images loaded successfully

7 DICOM_ERROR_MEMORY

Memory uses : 1148 Mo / 2 Go
 
#3 Posted : Tuesday, March 16, 2010 7:38:06 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

Please note that if these files are compressed DICOM files, the GetImage() function will decompress them and that should take more memory than the disk file size.

Are you loading all these large DICOM files into memory at the same time? If yes, LEADTOOLS v16.5 has 64-bit support, which allows you to exceed the limited memory capabilities of 32-bit Windows. This means on a 64-bit system, you can exceed the 2 to 4 GB limitation and be able to work with larger images if you need to.

Can you try our 64-bit DLLs on a 64-bit Windows system with plenty of free memory?
 
#4 Posted : Wednesday, March 17, 2010 4:49:14 AM(UTC)

Snyx  
Snyx

Groups: Registered
Posts: 6


"Can you try our 64-bit DLLs on a 64-bit Windows system with plenty of free memory?"

The application is actually not running on 64-bit windows system, i resolve it and tell you what happens with leadtools 16.5 64-bit DLLs and 4GB of RAM.


"Are you loading all these large DICOM files into memory at the same time?"

I have 2 medical screens (= 10MegaPixel) and i want to show 12 DICOM images at the same time.



"Please note that if these files are compressed DICOM files, the GetImage() function will decompress them and that should take more memory than the disk file size."

It's right, DICOM files are compressed, and use 20MB in disk space but 70 MB on RAM.
 
#5 Posted : Friday, March 19, 2010 6:14:43 AM(UTC)

Snyx  
Snyx

Groups: Registered
Posts: 6


It's finaly impossible for me to compile a 64-bit version.

Include of Leadtools 16.5 64-bit DLLs are ok but I need an other library who's not compatible with 64-bit.


However, I created an application that uses only GetImage() and I compiled 32-bit and 64-bit version.
I run this application on 64-bit windows system with 4GB of RAM and i try to load 25 DICOM images 71MB each, and the result is :

32-bit : 10 images loaded succesfully, all next are DICOM_ERROR_MEMORY
64-bit : 25 images loaded succesfully and no DICOM_ERROR_MEMORY

after all GetImage() :
application 32-bit size in memory : 736 MB (10 * 71 = 710)
application 64-bit size in memory : 1.8 GB (25 * 71 = 1775)


What do you think about that ?
Is there a way to work in 32-bit ? I do not exceed the 2GB a 32-bit application can have...


thanks for reply
 
#6 Posted : Sunday, March 21, 2010 2:04:27 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

Since this is a Win32 limitation, you could consider using some programming techniques to reduce memory usage.

For example, you could use TYPE_DISK images instead of conventional memory images. Another approach is to load reduced-size copies of the images and only load one image at full size when the user needs it. If the user zooms to a different image, free the loaded image and load the new image at full size and so on.
 
#7 Posted : Tuesday, March 23, 2010 1:44:19 AM(UTC)

Snyx  
Snyx

Groups: Registered
Posts: 6


I test with : LMemoryFile::SetBitmapMemoryInfo(pBitmap, TYPE_DISK, 0, 0, 0, 0, 0, SETMEM_MEMORY);
and I tried to do the same thing with my source code without success

Is it possible to know how you allocated memory disk (TYPE_DISK) instead of memory (TYPE_CONVENTIONAL) ?

because I can not use an object pBITMAPHANDLE so I copy the data value in my object who is allocated as follows:
malloc(pBitmap->Size);
then I do :
L_GetBitmapRow(pBitmap, pBuffer, y, nFrameWidth * 2);
and i frees the bitmap :
L_FreeBitmap(pBitmap);
 
#8 Posted : Tuesday, March 23, 2010 8:02:00 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

If you are not using a LEADTOOLS bitmap, and you only keep the pixel data in your own memory buffer, I'm afraid it will be your responsibility to manage those memory buffers and try to find a way to keep them in memory-mapped disk files.

I came across an article on MSDN about memory managing in Win32 applications. You can check this article using this link:
http://msdn.microsoft.com/en-us/library/ms810613.aspx
Please note that if you decide to use this information, we won't be able to help you with the details because it's outside the scope of our toolkit.
 
#9 Posted : Tuesday, March 23, 2010 11:12:42 PM(UTC)

Snyx  
Snyx

Groups: Registered
Posts: 6


Thank you for this article, I spent 2 hours yesterday without finding it on MSDN.

And thank you for monitoring this post, I think I have all I need to succeed now.

Best regards.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.219 seconds.