[Insight-users] Failed to allocate memory

Luis Ibanez luis.ibanez at kitware.com
Sun Mar 16 10:38:36 EDT 2008



Hi Zhihong,


It is not surprising that you are encountering memory
allocation problems for this example given the size
of your images.


Here is a short account of memory usage in the example

    Insight/Examples/DeformabeRegistration2.cxx

I assume that your lung images are CT or MRI at 16 per pixel.


  1) Read Fixed Image :                   339 Mb
  2) Read Moving Image :                  339 Mb
  3) Casting Fixed Image to float:        678 Mb
  4) Casting Moving Image to float:       678 Mb
  5) Histogram Matching Moving image:     678 Mb
  6) Demons filter def field (vectors):  2034 Mb
  7) WarpImageFilter (resampled moving):  678 Mb
  8) Casting warped image:                170 Mb


This amounts to:                        5593 Mb

        or about:                        5.46 Gb


If you are using Windows 32 bits, you are limited
to 2Gb for any given process.

You would need a 64 bits machine with at least 6Gb
in order to run this example in its current form.
Preferably 8 Gb, since the operating system will
take some RAM.


That being said, you can simplify the example
in multiple ways:

  A) Perform the casting & histogram matching
     in an independent program, and save the
     resulting images to disk.  This will remove
     items (1), (2) and (5).

  B) Do not perform the resampling (warping)
     inside the same program. Save the deformation
     field and run a separate program for warping
     the moving image. This will remove items (7)
     and (8).


With these changes, the memory allocations needed for
the DeformableRegistration itself will be reduced to
loading the two images as "float" images and allocating
the deformation field.  That is:  3.4 GigaBytes

This is still outside of the range of Windows 32 bits
machines.


Are there any sections of the image that you could crop ?
It is common to have a lot of empty space in CT and MRI
scans. You could consider removing some of that empty
space around the subject, in order to reduce the memory
allocations.



     Regards,


         Luis



------------------
zhihong hu wrote:
> Dear All
>  
> I am trying to register two sheep lung images by using Demons Deformable 
> Registration. The images are 3 dimensional and each is about 339MB. The 
> image format is Analyze file format.
>  
> I have tried 3 different programms. One is DeformableRegistration2.cxx 
> from the ITK Software Guide. I also tried Diffeomorphic Demons by Tom 
> Vercauteren group and Thirion Demons by Hans Jonson group in the 
> University of Iowa.
> When I registered the images, all have shown the problem that " Failed 
> to allocate memory". I tried a few computers both in linux and under 
> windows. The computer memory should be in GB.
>  
> However, I also tried some small images and all works well.
>  
> I am a newer in image processing. I can not figure out the problem. Is 
> it possible the memory allocation method does not work for the large 
> images? Please help me. Thanks.
>  
> Jewel from University of Iowa
>  
>  
> 
> 
> 
> 
>  
> 
> ------------------------------------------------------------------------
> Windows Live Hotmail is giving away Zunes. Enter for your chance to win. 
> Enter Now! 
> <http://www.windowslive-hotmail.com/ZuneADay/?locale=en-US&ocid=TXT_TAGLM_Mobile_Zune_V3>


More information about the Insight-users mailing list