[Insight-users] Using spatial objects for masking

David Pastor david.pastor at die.upm.es
Mon Nov 15 11:03:24 EST 2010


Hello,

I've added these lines to my registration without mask

std::cout<<"Set Mask spatial object"<<std::endl;

metricSSD->SetFixedImageMask(mask);

metricSSD->SetUseSequentialSampling(true);

metricSSD->SetUseAllPixels(false);

I use the methods "SetUse.." as it has worked for me to tell the 
registration the Region to consider in the registration. However, with the 
mask it returns the following transform even for 1 iteration

OUTPUT> Rotation(rad) = -1.#IND : -1.#IND degrees

OUTPUT> Rotation(rad) = -1.#IND : -1.#IND degrees

OUTPUT> Rotation(rad) = -1.#IND : -1.#IND degrees

OUTPUT> Translation X = -1.#IND

OUTPUT> Translation Y = -1.#IND

OUTPUT> Translation Z = -1.#IND

OUTPUT> Iterations = 1

OUTPUT> Metric value = -1.#IND

I get the same result if I mask the Fixed Image before registering (setting 
to 0 the values outside the region of binary image that I use to create the 
spatial object for the mask above) and use this configuration with 
minValMetric=1:

std::cout<<"Do not consider pixes with value smaller than 
"<<minValMetric<<std::endl;

metricSSD->SetFixedImageSamplesIntensityThreshold(minValMetric);

metricSSD->SetUseFixedImageSamplesIntensityThreshold(true);

metricSSD->SetUseSequentialSampling(true);

metricSSD->SetUseAllPixels(false);

I thought that SetUseAllPixels is not needed to be set to false, but I 
needed when specifying the SetFixedRegion method. That's the only option 
that has worked when trying to mask the fixed image for me.

Best,

David





----- Original Message ----- 
From: "Karthik Krishnan" <karthik.krishnan at kitware.com>
To: "David Pastor" <david.pastor at die.upm.es>
Cc: <insight-users at itk.org>
Sent: Thursday, November 11, 2010 1:23 PM
Subject: Re: [Insight-users] Using spatial objects for masking


> ImageMaskSpatialObject is what you need. You can set these for the
> fixed and moving image.
>
> For limiting metric computation to axis aligned regions in addition,
> you can use SetFixedImageRegion. This method is not available for the
> moving image.
>
> If you need more fancy region specifications, you can create your own
> spatial object, since the registration frameowork will accept any
> fixed and moving spatial object.
>
> --
> karthik
>
> On Thu, Nov 11, 2010 at 5:16 PM, David Pastor <david.pastor at die.upm.es> 
> wrote:
>> Hello,
>>
>> I'm trying to select the right mask for a registration process. I've seen
>> that ImageSpatialObject can be used as mask to restrict the metric to a
>> specific region, but it does count zero values. ImageMaskSpatial object 
>> does
>> not count them as it returns false for isInside, but I'm not sure it does 
>> it
>> for the whole image or you can define a region where to check, so what 
>> I'm
>> looking for is a mask that defines a region (so a binary spatial object 
>> is
>> defined) and within that region it does not count zero values.
>>
>> Best,
>> David
>> _____________________________________
>> 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.html
>>
>> 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