[Insight-users] Fwd: SpatialObjectToImageFilter run time

Dan Mueller dan.muel at gmail.com
Tue Feb 5 23:40:55 EST 2013


Hi Cemal,

The problem is in the design of the SpatialObjectToImageFilter. This
filter iterates over the entire image and for each pixel queries
whether the spatial object resides in the current pixel. The
MaskedSpatialObjectToImageFilter attempts to alleviate this issue by
only querying the spatial object for pixels which are likely to
contain the object. This approach only works for sparse spatial
objects i.e. objects which do not fill the entire image. The
MaskedSpatialObjectToImageFilter  Insight Journal submission was
written for ITKv3 and is evidently now broken for ITKv4. Unfortunately
I don't have time to help getting it compile with ITKv4.

Another approach is improve speed is to iterate only the bounding box
of each object. I implemented this approach (though not for
SpatialObjects) here:
    http://code.google.com/p/manageditk/source/browse/trunk/Source/Modules/IntensityFilters/itkGenerateMaskImageFilter.h
    http://code.google.com/p/manageditk/source/browse/trunk/Source/Modules/IntensityFilters/itkGenerateMaskImageFilter.txx
This filter allows you to specify a number of ellipses, boxes, and
points to generate a mask image. Again, this code was written for
ITKv3 and may not compile with ITKv4...

Good luck.

Regards, Dan

On 6 February 2013 12:50, Cagatay Bilgin <bilgincc at gmail.com> wrote:
> Hi, I've been using SpatialObjectToImageFilter for a while to create
> synthetic images and have been upset with the run time. For 10 ellipse
> objects (3d) the run time is 1 minute, for 20 objects it's around 5 minutes.
> Everything is compiled in release mode, and the rest of the kit runs as
> expected.
>
> I found an email on the emailing list where Dan Mueller suggests using
> MaskedSpatialObjectToImageFilter
> http://itk-users.7.n7.nabble.com/SpatialObjectToImageFilter-slow-td27261.html
> Unfortunately the code does not compile; some typedefs are not defined, and
> some variables are not declared. I tried fixing them and got it to compile
> but when I tried running the example I got a blank image. Do you have any
> suggestions?
>
> Thanks,
> Cagatay
>
>
> --
> Cemal Cagatay Bilgin
> Life Sciences Division
> Lawrence Berkeley National Lab
> MS977, One Cyclotron Road
> Berkeley, CA 94720, USA
> Email: ccbilgin at lbl.gov
> _____________________________________
> 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.php
>
> 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