[Insight-users] Re: metrics and image masks
Christoph Niedermayr
niedermayr at trium.de
Thu Aug 17 08:21:04 EDT 2006
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
More information about the Insight-users
mailing list