[Insight-users] Using spatial objects for masking

Karthik Krishnan karthik.krishnan at kitware.com
Fri Nov 12 13:23:02 EST 2010


Are you catching any exceptions that may be thrown using a try-catch
block. It could be that the registration method is throwing an
exception cause too may samples are mapping outside the moving image
masked buffer, or that there is no overlap between the mask and the
fixed image etc.

Try setting the number of iterations to 1 and see how long that takes.
Using a ImageMaskSpatialObject should not be that slow. Its just one
PointToIndex and pointer dereferencing, that's far outweighted by the
other computations involved in evaluating the metric.

In any case, its a good idea to observe each iteration of the
registration process. See the several examples in
Examples/Registration

On Fri, Nov 12, 2010 at 10:10 PM, David Pastor <david.pastor at die.upm.es> wrote:
> Hello,
>
> I also have tried to "mask" the registration by setting the region of the
> fixed image, that should be like using a box as spatial object, and I get
> the same problem, the registration starts but does not return the control to
> the main thread... is it necessary to use listeners when you process with
> masks or something like that? I'm using the optimized registration of the
> review if it makes any difference.
>
> Regards,
> David
>
>
> ----- Original Message ----- From: "David Pastor" <david.pastor at die.upm.es>
> To: "Karthik Krishnan" <karthik.krishnan at kitware.com>
> Cc: <insight-users at itk.org>
> Sent: Friday, November 12, 2010 3:56 PM
> Subject: Re: [Insight-users] Using spatial objects for masking
>
>
>> Hello,
>>
>> I've tried to use ImageMaskSpatialObject to mask my fixed image, but it
>> seems that it gives me computational problems as the registration starts but
>> never returns the value of the metric. Can it be because it gets really
>> slow? or do I miss something else?
>>
>> The code works fine if I just remove the line SetFixedImageMask.
>>
>> An alternative is to use SetFixedImageRegion, but then I'm not very sure
>> that the fixed would be correctly aligned with the moving...
>>
>> 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