[Insight-users] spatial objects and Update

Luis Ibanez luis.ibanez at kitware.com
Mon Sep 3 18:37:49 EDT 2007


Hi Xabier,

Are you planning to sweep the ellipsoid through the entire image ?

If so, you may get a better performance by using the Shape iterators
instead of the EllipsoidSpatialObject and the calculator.

In a Shape iterator you "program" the shape of the ellipsoid, and
then you move the iterator through the image. At every position of
the iterator you can request the intensity values of the N pixels
that are inside the neighborhood defined by the shape.

You may find interesting to look at this iterator in the
ITK Software Guide

       http://www.itk.org/ItkSoftwareGuide.pdf

In the Chapter "Image Iterators".

Note that in this case, it will be up to you to compute the
statistics. I would assume that you are computing something
like Mean and Variance..., or are you interested in some
sort of higher order statistics ?



    Regards,


        Luis


----------------------------------------
Xabier Artaechevarria Artieda wrote:
> Hi all,
> I am calculating statistics inside a spatial object, varying its  
> position across the image. I based on the example  
> SpatialObjectToImageStatisticsCalculator.txx for that.
> I just change the offset in every iteration, according to an image  
> iterator. However, I have realized that the bounding box is not  
> correct, if I do not ?update? the spatial object in every iteration.  
> The problem with that is that it takes a considerable time. Is it  
> necessary to update every time?  Is there a way to avoid it or do it  
> faster?
> 
> The relevant part of the code is shown below:
> 
> for(inIt.GoToBegin(); !inIt.IsAtEnd(); ++inIt)
>     {
>     for(int dim=0; dim < maximumDimension; ++dim)
>       {
>       ellipseCenter[dim] = inIt.GetIndex()[dim];
>       }
>       m_Ellipse->SetRadius(5);
>       m_Ellipse->GetIndexToObjectTransform()->SetOffset(ellipseCenter);
>       m_Ellipse->ComputeObjectToParentTransform();
>       m_Ellipse->Update();  // can this be avoided?
> 
>       m_Calculator->SetImage(edgeImage);
>       m_Calculator->SetSpatialObject(m_Ellipse);
>       m_Calculator->Update();
>    }
> 
> Thanks in advance,
>  Xabi


More information about the Insight-users mailing list