[Insight-users] Exception on image registration

Lodron, Gerald Gerald.Lodron at joanneum.at
Mon Nov 23 03:18:04 EST 2009


Hi,

My images are in dicom format so they should be 16bit. I load them in float format (also signed short tested). Both images are form a CT data set but can differ in size or spacing (which should already be implemented in ITK, is that right?)

I would prefer normalized correlation as metric. Is there a list which metric needs the gradient?

Another question: What is the NumberOfSpatialBins parameter in the metric, i do nut understand this value!

Best regards,











Hi Gerald,

During the registration process, the Image Metric internally computes the gradient of the Moving image.


The gradient image has a Vector of 3 doubles per pixel, which in your case leads to:

 (512x515x300) pixels x (3x4) bytes/pixel = 900 Mbytes

Just for the gradient of the moving image.


Assuming that the original fixed and moving images has a 8 bits pixels, they take 75 Mb each, or 150 Mb each if they are using 16bits per pixel.

Therefore, with just the two input images and the gradient image, you are already above 1 Gb.


As John pointed out, in a Windows 32 bits system, you can only address 2Gb from inside any given program.

Therefore, it is not surprising that you are running out of memory.



Your options are:

1)  Crop the Fixed image and Moving images to
     the minimum needed regions of interest

and/or

2) Subsample the Fixed and Moving images

and/or

3) Use an image metric that does not compute
    the Gradient of the Moving image.

    Please let us know what are the modalities of
    your images, if you want us to recommend any metric.


and / or

4)  Move to a 64 bits machine.



I would suggest that you try options (1) and (3) first.

Since it is common for medical images to have a lot of empty space around the region of interest.
You may be able to crop that 512x512 region down to 300x300 where the actual anatomy is.

--

The memory management that you describe in your email, is what we call Streaming, and it is indeed implemented in many ITK filters when the algorithmic nature of the filter allows.


Applying this technique to the process of registration is far from trivial given that at every evaluation of the image metric you actually need to access the entire Fixed image and Moving image.  Of course, it is possible that someone could come up with a clever way of streaming data during the registration process. In which case, we will certainly love
to see such method posted as an Insight Journal paper    :-)



      Regards,


          Luis


--------------------------------------------------------------------------
On Mon, Nov 16, 2009 at 2:41 AM, Lodron, Gerald <Gerald.Lodron at joanneum.at> wrote:
> I tried it but my PC does not start with that option (blue screen, Windows XP 32 bit).
>
> I don't understand it. I thought ITK works with image regions to address only those pixels which can currently be addressed. In that way the image should be splitted and each subimage is calculated seperately, this model should avoid an memory size error. Why is that not implemented?
>
>
>
>
>
>
>
>
>
>
>
>
>
>> I try to register two images and get following exception on StartRegistration():
>>
>> Itk::ExceptionObject(0147B858)
>> Location_ "class itk::CovariantVector<double,3> *__thiscall itk::ImportImageContainer(unsigned long, class itk::CovariantVector<double, 3>>::AllocateElements(unsigned long) const"
>> File_ 
>> d:\develop\source\insighttoolkot-3.16.0\code\common\itkImportImageCon
>> tainer.txx
>> Line: 188
>> Description: Failed to allocate memory for image
>>
>> I thougt itk can handle arbitrary image sizes (my images are 512x512x300)?
>>
>
> It handles these for us.
>
>>  I use the itk::ImageRegistrationMethod for my registration, the images are of same type (itk::OrientedImages<singed short,3>) , can anyone give me a hint?
>>
>
> You are probably running out of address space. Look at how much memory 
> is being used in taskmanager. In 32 bit windows the default address 
> space is 2GB of that 2GB the largest memory block is about 1.2GB. The 
> reason why 1.2GB is the maximum block is caused by memory 
> fragmentation caused by windows dlls loading inside of this 2GB 
> address space. You can extend the address space limit to 3GB by using 
> the /3GB boot.ini switch and linking your application with 
> LARGEADDRESSAWARE.
>
> http://msdn.microsoft.com/en-us/library/ms791558.aspx
>
> John
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list