[Insight-users] SetImage in ImageMaskSpatialObject

Julien Jomier jjomier at cs.unc.edu
Thu May 12 11:39:39 EDT 2005


Hi Marius,

Thanks for pointing this out. I've just checked in a fix for this. Can 
you try and let us know if it works?

Thanks again,

Julien

Marius Staring wrote:
> 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,
> 


More information about the Insight-users mailing list