[Insight-users] Memory prblem: failed to allocate memory

Luis Ibanez luis.ibanez at kitware.com
Tue Jun 12 21:02:13 EDT 2007


Hi Lars,

The main difference between the metrics that you are using is the
way in which they compute the derivatives of the moving image.

The ones that are producing the memory allocation problem, are
the metrics that use the GradientMagnitudRecursiveGaussian filter
for computing the gradient magnitude.

This filter uses a large memory footprint in order to provide
a fast computation.

The memory consumption is quite real:

Just compute the amount of memory for your image once it is
converted to float:

      512 x 512 * 245 * 4 bytes = 245 Mb

and put in a cascade of three filters = 735 Mb

plus the memory of the original image : 122 Mb....

you can easily reach about 1Gb...

Your operating system and other applications can easily be
taking 200 Mb to 500Mb...



Some options are:


1) Move to a 64 bits machine with more memory
    (Expensinve an annoying, but the real solution for the
     long term. those datasets are just going to get bigger..)


   OR


2) Replace the GradientMagnitudeRecursiveImageFilter in the
    ImageToImageMetric class with the GradientMagnitudeFilter
    (trading off memory for computation time,
     get some coffe ready for this programming exercise...)


   OR

3) Subsample your image during the registration
    (not a very good option, since you will sacrifice precision)


   OR


4) Use an optimizer that does not require gradients,
    such as the OnePlusOne evolutionary optimzer
    (a good option).



   Regards,


      Luis


-------------------
Lars Nygard wrote:
> Hi luis,
> 
> The images Im trying to register are one MRT1-image which I use as fixed.
> Spacing = 1.0 1.0 1.0; DimSize = 512 512 245; ElementType = MET_USHORT)
> The other image is a MRA-image
> (Spacing = 0.41 0.41 0.59; DimSize = 256 256 180; ElementType = MET_USHORT)
> 
> Im using a computer at my workplace (sintef norway) and it has a 2.26 GHz processor
> and 1.99 GB of RAM. 
> 
> I did some experiments and found out that MutualInformation works fine but normalizedCorrelation,
> patternIntensity and meanSquares all give the aforementioned error. When I change the meta
> information for the MRA image DimSize to 400 400 200, all metrics worked but are Really slow.
> PatternIntensity seems to be the slowest of all three (normalizedCorr, PaternInt and MeanSquare)
> 
> Im puzzled that three metrics give the same error and behave similar when I decrease the
> Dimsize.
> If you want I can send you the program. It's not very big.
> regards,
> Lars Nygard
> 
> ----- Original Message ----
> From: Luis Ibanez <luis.ibanez at kitware.com>
> To: Lars Nygard <lnygard at yahoo.com>
> Cc: insight-users at itk.org
> Sent: Tuesday, June 12, 2007 5:31:56 AM
> Subject: Re: [Insight-users] Memory prblem: failed to allocate memory
> 
> 
> Hi Lars,
> 
> 
> A couple of basic questions:
> 
> 
> 1) How big are your images ?
> 
>     How many pixels along every direction ?
>     (for both the Fixed and Moving images)
> 
> 
> 2) How much RAM do you have in your computer ?
> 
> 
> Please let us know,
> 
> 
>    Thanks
> 
> 
>       Luis
> 
> 
> 
> -----------------------
> Lars Nygard wrote:
> 
>>Hi All,
>>
>>Im working on a 3D registration program for MRI images. Ive asked this question a while
>>ago but IM still strugling with this. My program works fine when I use versor3Drigid transform
>>with MattesMutualInformation, but when I change the metric to either meansquare, normalized
>>Correlation or Pattern Intensity, I get the same error (see below). It's located in the
>>imageImportContainer. Are there combinations of optimizer, transformation and metric that dont
>>work together? or that are better avoided.
>>Is there a way I can split up the process in the metric. For example first
>>compute a gradient image and then supply it to the metric? Any idea is welcome.
>>regards,
>>Lars Nygard
>>error
>>-------------------------------------------------------------------------------------------------------------
>>itk::ExceptionObject (0133FAD8)
>>Location: "class itk::CovariantVector<double,3> *__thiscall itk::ImportImageCont
>>ainer<unsigned long,class itk::CovariantVector<double,3> >::AllocateElements(uns
>>igned long) const"
>>File: c:\documents and settings\lars\desktop\insight toolkit\source\insighttoolk
>>it-3.2.0\code\common\itkImportImageContainer.txx
>>Line: 188
>>Description: Failed to allocate memory for image.
>>---------------------------------------------------------------------------------------------------------------------------
>>
>>
>>
> 
> 
> 
>       
> _________________________________________________________
> Alt i én. Få Yahoo! Mail med adressekartotek, kalender og
> notisblokk. http://no.mail.yahoo.com
> 


More information about the Insight-users mailing list