[Insight-users] Bug in itkShrinkImageFilter
Koen Van Leemput
koen.vanleemput@hus.fi
Thu, 12 Sep 2002 10:14:08 +0300
Hi,
I think there is a bug in=20
itkShrinkImageFilter::GenerateInputRequestedRegion(). More specifically, =
the=20
size of the inputRequestedRegion is not calculated properly.
Here is some code reproducing the error:
typedef itk::ImageRegion<1> RegionType;
typedef itk::Image<float, 1> ImageType;
typedef itk::ShrinkImageFilter<ImageType, ImageType> ShrinkerType;
RegionType::IndexType index =3D {5};
RegionType::SizeType size =3D {10};
RegionType region(index, size);
ImageType::Pointer image =3D ImageType::New();
image->SetRegions( region );
image->Allocate();
ShrinkerType::Pointer shrinker =3D ShrinkerType::New();
shrinker->SetInput( image );
shrinker->SetShrinkFactors( 2 );
try
{
shrinker->Update();
}
catch( itk::ExceptionObject & err )
{
std::cout << "Caught an exception: " << std::endl;
std::cout << err << std::endl;
std::cout << image->GetLargestPossibleRegion() << std::endl;
std::cout << image->GetRequestedRegion() << std::endl;
}
In itkShrinkImageFilter::GenerateInputRequestedRegion(), the calculation =
of=20
the size is =20
inputRequestedRegionSize[i]
=3D outputRequestedRegionSize[i] * m_ShrinkFactors[i];
but should be
inputRequestedRegionSize[i]
=3D outputRequestedRegionSize[i] * m_ShrinkFactors[i]=20
- m_ShrinkFactors[i] + 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