[Insight-users] Danielsson DistanceMap - Unable to allocate memory for image

Luis Ibanez luis.ibanez at kitware.com
Tue Feb 23 17:39:02 EST 2010


Hi James,


Here are some alternatives:


Option (A): You usually don't need to know the values of the distance
map in every pixel of the image. You could get an approximation by
using a FastMarching filter and only computing the distance map up to
a certain "distance" from the object. E.g. like computing the distance
in a band around the object of interest.


Option (B): The Danielsson filter not only computes the distance map,
it also allocates memory for:

     1) a Voronoi map (that you may not need)
     2) a Vector image with X,Y,Z distances (that you may not need)

You may be able to compute the distance image, disconnect it from
the pipeline, and destroy the filter, so that (1) and (2) are deallocated.

The distance map is probably not the only filter taking memory in your
pipeline. So, by re-arranging the operations you may be able to fit
this into your RAM.


Option (C) :  You may want to try enabling the ReleaseDataFlag()
in all the filter that precede the Distance map filter. That will release
some memory as well.


and, since your final goal is to perform registration:


Option (D): You may find useful the class

              itkBinaryMaskToNarrowBandPointSetFilter

it is well suited for performing a registration between a set of points
and a binary mask.

You will find details in:

InsightDocuments/Papers/MedIASpecialIssue/NarrowBandToImageRegistration

http://www.itk.org/cgi-bin/viewcvs.cgi/Papers/MedIASpecialIssue/NarrowBandToImageRegistration/?root=InsightDocuments



     Regards,


            Luis


-------------------------------------------------------------------------------------------------------
On Tue, Feb 23, 2010 at 7:44 AM, Malsoaz James <jmalsoaz at yahoo.fr> wrote:

> Hi,
>
> I'm using the DanielssonDistanceMapImageFilter on 3D volume. Unfortunately,
> I'm experiencing troubles when the 3D volume is too big and I get this
> error: "Unable to allocate memory for image".
>
> Here is the code that I'm using:
> typedef itk::Image<unsigned char, 3> ImageType3D
> typedef itk::DanielssonDistanceMapImageFilter<ImageType3D, ImageType3D>
> FilterType;
>     FilterType::Pointer filter = FilterType::New();
>
>     typedef itk::RescaleIntensityImageFilter<ImageType3D, ImageType3D>
> RescalerType;
>     RescalerType::Pointer scaler = RescalerType::New();
>     filter->SetInput(itkImporter->GetOutput());
>     scaler->SetInput( filter->GetOutput() );
>     scaler->SetOutputMaximum(255);
>     scaler->SetOutputMinimum(0);
>    try
>     {
>     scaler->Update();
>     }
>      catch( itk::ExceptionObject & err )
>     {
>         std::cerr << "ExceptionObject caught !" << std::endl;
>         std::cerr << err << std::endl;
>     }
>
>
> It works great when the dimension volume are 512*512*100. But when I have
> volume with big dimensions (ie 512*512*350), I get the error.
>
> Is there a solution for this problem ? Certainly I can't compute the
> distance map using this filter on big volumes because of memory issues.
>
> Can I use something else to compute the distanceMap ?
>
> By the way, my final goal with the DistanceMap is to use it in a
> registration process.
> Indeed, I have CT images and a list of points obtained by a navigation
> system during a surgery. I would like to do the registration to find the
> transformation between the "real" points on the patient and the surface on
> my volume (this volume has been compute with the CT images).
> Certainly, ITK offers good solution for such registration needs. Have you
> any idea?
>
> Thank you for you help.
> Best
> James
>
>
>
> _____________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100223/b0aaf4d1/attachment.htm>


More information about the Insight-users mailing list