View Issue Details [ Jump to Notes ] | [ Print ] |
ID | Project | Category | View Status | Date Submitted | Last Update |
0011699 | ITK | ITK | public | 2011-01-14 11:56 | 2011-01-18 17:17 |
|
Reporter | Andras Lasso 2 | |
Assigned To | Bill Lorensen | |
Priority | normal | Severity | minor | Reproducibility | always |
Status | assigned | Resolution | open | |
Platform | Win7-64, Linux-64 | OS | | OS Version | |
Product Version | ITK-3-18 | |
Target Version | | Fixed in Version | | |
|
Summary | 0011699: ImageMaskSpatialObject IsInside and ValueAt methods give inconsistent results |
Description | 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).
|
Steps To Reproduce | Create an ImageMaskSpatialObject, call IsInside and ValueAt functions near the masked/non-masked region boundary. Many times IsInside returns 1 while ValueAt returns 0.
|
Tags | No tags attached. |
|
Resolution Date | |
Sprint | |
Sprint Status | backlog |
|
Attached Files | itkImageMaskSpatialObject-IsInsideFix.patch [^] (602 bytes) 2011-01-14 11:56 [Show Content] [Hide Content]64c64
< IndexType index;
---
> typename Superclass::InterpolatorType::ContinuousIndexType index;
67c67
< index[i] = static_cast<int>( p[i] );
---
> index[i] = p[i];
77,78c77,81
< const bool insideMask = (this->GetImage()->GetPixel(index) != NumericTraits<PixelType>::Zero);
<
---
> typedef typename Superclass::InterpolatorType::OutputType InterpolatorOutputType;
> const bool insideMask = (
> DefaultConvertPixelTraits<InterpolatorOutputType>::GetScalarValue(this->m_Interpolator->EvaluateAtContinuousIndex(index))
> != NumericTraits<PixelType>::Zero);
>
itkImageMaskSpatialObjectTest2.cxx [^] (8,841 bytes) 2011-01-18 17:17 |
|