[Insight-users] Bug in itkImageRegion
Luis Ibanez
luis . ibanez at kitware . com
Wed, 04 Sep 2002 08:56:11 -0400
Hi Koen,
The ImageRegion is probably doing the right thing.
The Region created in your example is starting at
index 0 and have size 100. This means that indices
inside the region are in the range [0,99] (inclusive).
The continuous index 99.9 is actually outside the region.
The continous index 98.9 will be inside...
Please let us know if you find that this makes sense.
Thanks
Luis
===========================
Koen Van Leemput wrote:
> Hi all,
>
> I think there is a bug in itkImageRegion::IsInside(const
> ContinuousIndex<TCoordRepType,ImageDimension> &): indices outside a region
> are actually reported to fall inside. Here is some example code reproducing
> the error:
>
> typedef itk::ImageRegion<1> RegionType;
> RegionType::IndexType index = {0};
> RegionType::SizeType size = {100};
> RegionType region(index, size);
> itk::ContinuousIndex<double, 1> continuousIndex;
> continuousIndex[0] = 99.9;
> std::cout << region.IsInside( continuousIndex ) << std::endl;
>
> In itkImageRegion::IsInside(const
> ContinuousIndex<TCoordRepType,ImageDimension> &), the test "if( index[i] >=
> bound )" should probably be replaced with "if ( index[i] > bound-1 )"
>
> Cheers,
>
> Koen
>
>
>