[Insight-users] Speeding up the SpatialObjectToImageFilter

Anja Ende anja.ende at googlemail.com
Tue Jun 17 05:07:44 EDT 2008


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


More information about the Insight-users mailing list