[Insight-users] Bug in itkImageRegion

Lorensen, William E (Research) lorensen at crd . ge . com
Wed, 4 Sep 2002 08:59:35 -0400


Luis,
His error report said that 99.9 was INSIDE. This is incorrect and I've checked in a fix.

Bill

-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez@kitware.com]
Sent: Wednesday, September 04, 2002 8:56 AM
To: Koen Van Leemput
Cc: insight-users@public.kitware.com
Subject: Re: [Insight-users] Bug in itkImageRegion



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
> 
> 
> 




_______________________________________________
Insight-users mailing list
Insight-users@public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-users