[Insight-users] Masks in itkMutualInformationImageToImageMetric

Vicente Grau vicente at robots.ox.ac.uk
Thu Aug 18 12:05:07 EDT 2005


Thanks a lot. I have tried the new CVS function and, as far as I see, it 
works just fine.

Vicente

Karthik Krishnan wrote:

>
>
> Vicente Grau wrote:
>
>> Thanks so much for your help and for the quick update. In the new CVS 
>> file, as far as I see, you have implemented the fixed mask, but not 
>> the moving one, is this right?
>
>
> Thanks.. Yes I needed to check if the transformed point was in the 
> moving mask as well.. Fixed in CVS.
>
>> And another question, that I guess would apply also to the 
>> IsInsideBuffer() call: will the number of samples be exactly the 
>> selected one, or will it be smaller after the samples that lie 
>> outside the selected area are discarded?
>>
> No. the number of samples will not be smaller. The IsInsideBuffer() 
> serves a different purpose. It is to ensure that at least one sample 
> after registration maps from the moving to the fixed image region. 
> (within the masks if specified). This is to preclude choosing a 
> bizzare initial transform that provides no overlap between the fixed 
> and moving image.
>
> Thanks
> regards
> karthik
>
>> Thanks again,
>>
>> Vicente
>>
>> Karthik Krishnan wrote:
>>
>>>
>>> Vicente Grau wrote:
>>>
>>>> Thanks very much for the explanation, now I understand it better. 
>>>> As you suggested, I have been looking at the IsInside() values 
>>>> returned by the metrics. It is clear in the code how masks are 
>>>> applied in NormalizedCorrelation or MeanSquares metrics; however, I 
>>>> don't see where the masks are considered in 
>>>> itkmutualinformationimagetoimagemetric.txx (I can only see a call 
>>>> to IsInsideBuffer() ). Are masks implemented for Mutual Information 
>>>> too? I am using ITK 2.0.1.
>>>
>>>
>>>
>>>
>>> Its been added to CVS.
>>>
>>> Thanks
>>> regards
>>> karthik
>>>
>>>>
>>>> Vicente
>>>>
>>>>
>>>> Karthik Krishnan wrote:
>>>>
>>>>>
>>>>>
>>>>> Vicente Grau wrote:
>>>>>
>>>>>> Thanks very much for your answer.
>>>>>> The image resolutions are the same for mask and input image: I 
>>>>>> have copied the values directly from one mha header to the other 
>>>>>> to make sure of that.
>>>>>> I have actually taken the mask object definition / application 
>>>>>> from ImageRegistration12.cxx, but as it didn't work for me, I 
>>>>>> wondered if it had to be used differently in a multiresolution 
>>>>>> framework. Does MultiResolutionImageRegistrationMethod take care 
>>>>>> of the masking at different scales? In this case, should I define 
>>>>>> a new RecursiveMultiResolutionPyramidImageFilter for the mask? 
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Since the mask is a spatial object, everything is done in physical 
>>>>> space and there should be no need to generate a pyramid. The 
>>>>> MultiResolutionImageRegistrationMethod internally uses a pyramid 
>>>>> to generate Fixed and Moving images at a bunch of resolutions. All 
>>>>> these images correspond to the same physical units, for instance 
>>>>> the one at quarter resolution has its spacing quadrupled.
>>>>>
>>>>> itkMultiResolutionPyramidImageFillter.txx
>>>>> line 404:       outputSpacing[idim] = inputSpacing[idim] * 
>>>>> shrinkFactor;
>>>>>
>>>>> When the metric needs to decide whether to evaluate the metric at 
>>>>> an index, it should do something like
>>>>>
>>>>> fixedImage->TransformIndexToPhysicalPoint( index, 
>>>>> physicalSpacePoint );
>>>>> if (!this->m_FixedImageMask->IsInside( physicalSpacePoint )) // 
>>>>> don't evaluate here.
>>>>>
>>>>> As you can see everything is done in physical space and you don't 
>>>>> need to shrink the masks.
>>>>>
>>>>> Did you try to dig into the IsInside to see if points ere really 
>>>>> outside ?
>>>>>
>>>>> Thanks
>>>>> karthik
>>>>>
>>>>>> And, how do I pass this pyramid to the 
>>>>>> MultiResolutionImageRegistrationMethod?
>>>>>>
>>>>>> Thanks a lot,
>>>>>>
>>>>>> Vicente
>>>>>>
>>>>>> Karthik Krishnan wrote:
>>>>>>
>>>>>>> On Tue, 2005-08-16 at 11:15 +0100, Vicente Grau wrote:
>>>>>>>  
>>>>>>>
>>>>>>>> I am trying to include masks for the fixed and moving images in 
>>>>>>>> a MultiResolutionImageRegistrationMethod, using Mutual 
>>>>>>>> Information. I have modified the MultiResMIRegistration 
>>>>>>>> application to include the masks, by creating them and adding
>>>>>>>>
>>>>>>>> m_Metric->SetFixedImageMask(m_FixedObjectMask);
>>>>>>>> m_Metric->SetMovingImageMask(m_MovingObjectMask);
>>>>>>>>
>>>>>>>> m_Registration->StartRegistration();
>>>>>>>>
>>>>>>>> however, the mask does not seem to make a difference at all: I 
>>>>>>>> get exactly the same results even when all pixels in the mask 
>>>>>>>> are zero.
>>>>>>>> Is it possible to use masks in a multiresolution framework?
>>>>>>>>   
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Yes it is. We've used this in the past. Are you sure that the 
>>>>>>> spacing of
>>>>>>> the mask and the image (at full resolution) are the same ? You 
>>>>>>> could try
>>>>>>> to dig into the Metric or your spatial object to see if the 
>>>>>>> IsInside
>>>>>>> function evaluates to false everywhere.
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>>>> Is this the right way to do it? Are there any examples I can use?
>>>>>>>>   
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ImageRegistration12.cxx, although not in the multi-resolution 
>>>>>>> framework,
>>>>>>> but the two aren't very different.
>>>>>>>  
>>>>>>>
>>>>>>>> Thanks very much,
>>>>>>>>
>>>>>>>> Vicente Grau
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Insight-users mailing list
>>>>>>>> Insight-users at itk.org
>>>>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>>>>   
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>> _______________________________________________
>>>>>> Insight-users mailing list
>>>>>> Insight-users at itk.org
>>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>>
>>>>>
>>>> _______________________________________________
>>>> Insight-users mailing list
>>>> Insight-users at itk.org
>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>
>>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>


More information about the Insight-users mailing list