[Insight-users] memory allocation for gradient

Rupert Brooks rupe.brooks at gmail.com
Wed Jun 27 10:10:16 EDT 2007


hi Lars,

I know the memory issue you mean, and i've been fiddling with this a
bit.  Someday my fiddling might even make it to the Insight journal,
but not particularly soon, so i will give you what hints i can right
now.

If you want to tackle changing the metric, i recommend taking a close
look at MattesMutualInformationImageToImageMetric, and imitating that
approach.  They use two memory saving approaches - they either compute
the gradient on the fly using a finite difference calculator, or they
get the gradient from the BSpline interpolator, if that is the
interpolator type.  The method ComputeGradient(...) is probably the
thing to look at.  Basically they are trading time for space in either
case, so you can expect these methods to run a bit slower than
precomputing the gradient.

Once you're in there messing with the code, you may want to make it
operate on a random subset of pixels.  There was a paper in the
Insight Journal, by Marius Staring, on this topic.
http://hdl.handle.net/1926/190

Good Luck,

Rupert B.

> Message: 6
> Date: Wed, 20 Jun 2007 06:43:04 -0700 (PDT)
> From: Lars Nygard <lnygard at yahoo.com>
> Subject: [Insight-users] Re: Insight-users Digest, Vol 38, Issue 42
> To: insight-users at itk.org
> Message-ID: <195132.39146.qm at web50205.mail.re2.yahoo.com>
> Content-Type: text/plain; charset=iso-8859-1

> Hi,
> Im having similar problems. Ive already said this some time ago.
> I get a failed allocation memory error when registering with metrics that
> need to compute the gradient image (such as meansquares).
> Today I also got an memory error using the Multi Resolution registration
> method. It's at exact the same place so Im suspecting this has the same
> cause (that is computing the gradient), although Im not sure
> Luis suggested to change the way the gradient is computed, So using
> GradientMagnitudeFilter instead of RecurssiveGradientFilter.
> Im a bit hesitant to start changing ITK base classes, Im quite positive this
> task will take me at least some days if not several weeks.
> If anybody has done this Id be interested to hear.
> regards,
> lars

-- 
--------------------------------------------------------------
Rupert Brooks
McGill Centre for Intelligent Machines (www.cim.mcgill.ca)
Ph.D Program in Intelligent Systems
http://www.cyberus.ca/~rbrooks


More information about the Insight-users mailing list