[Insight-users] SetImage in ImageMaskSpatialObject
Marius Staring
marius at isi.uu.nl
Thu May 12 10:31:27 EDT 2005
Hi all,
upon using the mask-functionality for image registration I noticed
something, which seems strange in my eyes.
I read in a mask image, and (because the metric expects a spatial
object) convert it to a ImageMaskSpatialObject. This is done by creating
an ImageMaskSpatialObject and then using the SetImage() function, after
which the spatial object can be set into the metric. So for a fixed
mask, this would be done as follows:
fixedMaskAsImage = fixedMaskImageReader->GetOutput();
fixedMaskAsSpatialObject->SetImage( fixedMaskAsImage );
myMetric->SetFixedImageMask( fixedMaskAsSpatialObject );
My question concerns the SetImage() part. In this SetImage()-function
the Scale-function of the Affine-transform is called with the mask image
spacing as an argument. This Scale-function multiplies the affine matrix
with the scales.
Now (here it comes), when using the SetImage()-function more than once,
the scales get multiplied, and multiplied, and so on, and the effect is
that when the metric is looking for samples within the mask, it can not
find sufficient (if any) samples anymore. Now, I do want to use
different masks every resolution and therefore I want to use SetImage()
more than once.
Shouldn't the SetImage() function avoid this multiplication of scales?
When looking at the name of the function I at least would assume that
setting another image after a while should just copy the information
from that new image, and not multiply it with former values.
Of course the workaround is to destroy the ImageMaskSpatialObject and
create a new one, and that is what I did. But it is confusing and took
me almost a day to find out what went wrong.
Regards,
--
Marius Staring
Image Sciences Institute
University Medical Centre Utrecht
Heidelberglaan 100, 3584 CX Utrecht, The Netherlands
phone: +31 (0)30 250 3186, fax: +31 (0)30 251 3399
marius at isi.uu.nl, http://www.isi.uu.nl/People/Marius
More information about the Insight-users
mailing list