MantisBT - ITK
View Issue Details
0011699ITKITKpublic2011-01-14 11:562011-01-18 17:17
Andras Lasso 2 
Bill Lorensen 
normalminoralways
assignedopen 
Win7-64, Linux-64
ITK-3-18 
 
backlog
0011699: ImageMaskSpatialObject IsInside and ValueAt methods give inconsistent results
ImageMaskSpatialObject< TDimension >::IsInside (which determines if the point is inside or not the masked region) uses index[i] = static_cast<int>( p[i] ) to convert from continuous index to integer index.

This is inconsistent with ImageSpatialObject< TDimension, PixelType >::ValueAt (which returns the pixel value at a specified position) that uses value = static_cast<double>(DefaultConvertPixelTraits<InterpolatorOutputType>:: GetScalarValue(m_Interpolator->EvaluateAtContinuousIndex(index))) to do the conversion.

The effect is that when using a mask for registration many points are incorrectly rejected at the mask boundary during the sampling step (in ImageToImageMetric<TFixedImage,TMovingImage>::SampleFixedImageRegion). When the mask is thin (such as when the ROI is a single slice) this often leads to registration failure (e.g., "Joint PDF summed to zero").

Proposed fix: Change ImageMaskSpatialObject::IsInside to convert continuous indices to integer indices the same way (using the interpolator) as it is done in ImageSpatialObject::ValueAt. See the attached patch that implements this fix. The patch fixed the problem that we encountered during single-slice registration (was tested on Linux and Windows).
Create an ImageMaskSpatialObject, call IsInside and ValueAt functions near the masked/non-masked region boundary. Many times IsInside returns 1 while ValueAt returns 0.
No tags attached.
patch itkImageMaskSpatialObject-IsInsideFix.patch (602) 2011-01-14 11:56
https://public.kitware.com/Bug/file/3623/itkImageMaskSpatialObject-IsInsideFix.patch
cxx itkImageMaskSpatialObjectTest2.cxx (8,841) 2011-01-18 17:17
https://public.kitware.com/Bug/file/3642/itkImageMaskSpatialObjectTest2.cxx
Issue History
2011-01-14 11:56Andras Lasso 2New Issue
2011-01-14 11:56Andras Lasso 2File Added: itkImageMaskSpatialObject-IsInsideFix.patch
2011-01-14 12:57Bill LorensenAssigned To => Bill Lorensen
2011-01-14 12:57Bill LorensenStatusnew => assigned
2011-01-18 17:17Andras Lasso 2File Added: itkImageMaskSpatialObjectTest2.cxx

There are no notes attached to this issue.