[Insight-users] Re: metrics and image masks

Luis Ibanez luis.ibanez at kitware.com
Thu Aug 17 08:39:48 EDT 2006


Hi Chirs,

What version of ITK are you using ?

There are no calls to GetPixel() inside the file


    Insight/Code/Algorithms/
      itkMattesMutualInformationImageToImageMetric.txx


What the metric calls is the method "IsInside" in lines
457 and 526.


BTW if you want to use an binary image as a mask,
the class that you should use is the

           itkImageMaskSpatialObject.h

as explained in the ITK Software Guide:

       http://www.itk.org/ItkSoftwareGuide.pdf

not the class

            itkImageSpatialObject.h

as you seem to be doing in your code.



     Regards,



        Luis



----------------------------
Christoph Niedermayr wrote:
> Am Donnerstag, den 17.08.2006, 13:57 +0200 schrieb Christoph Niedermayr:
> 
>>I stumbled upon the following:
>>I'm using itk::NormalizedCorrelationImageToImageMetric with both fixed and moving image masks.
>>my masks are itk::ImageSpacialObjects.
>>since i was getting segfaults i took a look into the code of itk::NormalizedCorrelationImageToImageMetric and itk::MattesMutualInformationImageToImageMetric and this turned up:
>>- at first a sample from the fixed image is taken.
>>- then it is checked whether the sample is inside the fixed mask by calling GetPixel(index). note that GetPixel *doesn't check the array bounds*. so this works as long the fixed mask has at least the size of the fixed image (is this safe to assume? i dont think so..)
>>- then the sample is transformed to the moving image space
>>- the interpolator determines whether the sample is within the moving image
>>- then it is *always* checked whether the sample is inside the moving mask, again by calling GetPixel(index). this can fail because the transformed point may be outside the moving image mask' buffer (which indeed has been tested using the iterator, but is ignored!)
> 
> 
> indeed, i was mistaken...
> bounds checking seems to be done inside ImageSpacialObject, before
> calling GetPixel. still, i'm getting segfaults because GetPixel is being
> called with invalid indices :(
> 
> Best regards,
> Chris
> 
> 
> _______________________________________________
> 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