[Insight-users] Bug in itkImageRegion

Koen Van Leemput koen . vanleemput at hus . fi
Wed, 4 Sep 2002 09:55:14 +0300


Hi all,=20

I think there is a bug in itkImageRegion::IsInside(const=20
ContinuousIndex<TCoordRepType,ImageDimension> &): indices outside a regio=
n=20
are actually reported to fall inside. Here is some example code reproduci=
ng=20
the error:

  typedef itk::ImageRegion<1>        RegionType;
  RegionType::IndexType    index =3D {0};
  RegionType::SizeType     size =3D {100};
  RegionType region(index, size);
  itk::ContinuousIndex<double, 1>  continuousIndex;
  continuousIndex[0] =3D 99.9;
  std::cout << region.IsInside( continuousIndex ) << std::endl;

In itkImageRegion::IsInside(const=20
ContinuousIndex<TCoordRepType,ImageDimension> &), the test "if( index[i] =
>=3D=20
bound )" should probably be replaced with "if ( index[i] > bound-1 )"

Cheers,

Koen


--=20
*************************************************************************=
****=20
Koen Van Leemput, Ph.D.                email : koen.vanleemput@hus.fi=20
Department of Radiology                  phone: +358 9 471 71331       =20
Helsinki University Central Hospital   mobile: +358 9 471 62300       =20
P.O. Box 340                                  fax:      +358 9 471 71342 =
      =20
FIN-00029 HUS                                                            =
              =20
FINLAND                                                                  =
                 =20
*************************************************************************=
****=20