[Insight-users] Speeding up the SpatialObjectToImageFilter

Dan Mueller dan.muel at gmail.com
Tue Jun 17 05:18:17 EDT 2008


Hi Anja,

You may want to look at my Insight Journal contribution "Using a Mask
to Decrease Computation Time for SpatialObject to Image Conversions":
http://www.insight-journal.org/InsightJournalManager/view_reviews.php?pubid=117

The approach taken is to firstly compute a low resolution mask of the
image, dilate the mask (to ensure it includes all areas), and then
compute the conversion only for pixels under the mask. As I wrote the
paper over 2 years ago, I can't recall if it will work for
BlobSpatialObjects, but you can give it a shot.

Hope this helps.

Regards, Dan

2008/6/17 Anja Ende <anja.ende at googlemail.com>:
> Hello everyone,
>
> I am using the SpatialObjectToImageFilter as follows:
>
> typedef typename itk::Image<unsigned char, 3> ImageType;
> typedef typename itk::SpatialObjectToImageFilter<PolygonType,
> ImageType> SpatialObjectToImageFilterType;
> typedef typename SpatialObjectToImageFilterType::Pointer
> SpatialObjectToImageFilterTypePointer;
> SpatialObjectToImageFilterTypePointer filter =
> SpatialObjectToImageFilterType::New();
> filter->SetInput(segmentation);
> typename ImageType::SizeType size;
> size[0] = sizeX;
> size[1] = sizeY;
> size[2] = sizeZ;
> filter->SetSize(size);
> filter->Update();
>
> In the above code, "segmentation" object is an itk::BlobSpatialObject
> type pointer and as you can see I am using it on a 3D volume.
>
> The problem I am facing is that this is very slow. Even when I have a
> blob object that defines a segmentation in only one slice and the rest
> of the slices are basically blank, still it is quite slow. The
> Update() call takes about 10 seconds on my machine. I am wondering if
> there is a way to speed this up with something like preinitializing
> the Filter with the size? Anyone has any ideas on this?
>
> Many thanks,
>
> Anja
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list