[Insight-users] Bug in BSplineDownsampleImageFilter / BSplineResampleImageFilterBase in itk 3.4.0

Andreas Wimmer Andreas.Wimmer at gmx.ch
Sat Mar 29 05:25:47 EDT 2008


Hi all!

I would like to report a problem with the
BSplineDownsampleImageFilter included in itk 3.4.0.

I'm frequently getting access violations when using the filter to reduce
the size of an odd sized volume, e.g. 512 x 512 x 183, by a factor of 2.

The exception occurs in the base class, BSplineResampleImageFilterBase,
in method

template <class TInputImage, class TOutputImage>
void BSplineResampleImageFilterBase<TInputImage, TOutputImage>
::CopyInputLineToScratch(ConstInputImageIterator & Iter)
{
   unsigned int j = 0;
   while ( !Iter.IsAtEndOfLine() )
     {
     m_Scratch[j] = static_cast<double>( Iter.Get() );
     ++Iter;
     ++j;
     }
}

when the iterator value is accessed via "Get". The reason for the
exception is the iterator pointing to a position which is out of the
input requrested volume.

I think the underlying reason is:

- the output size for the 512 x 512 x 183 volume is 256 x 256 x 91,
   which is calculated in
   BSplineDownsampleImageFilter::GenerateOutputInformation()

- the input requested region size is set accordingly to two times the
   output region size in
   BSplineDownsampleImageFilter::GenerateInputRequestedRegion(),
   in my case 512 x 512 x 182

- for the actual downsampling,
   BSplineResampleImageFilterBase::ReduceNDImage() is called

- there, in line 396, the input iterator which causes the exception
   mentioned above is set to
   ConstInputImageIterator inIterator1( workingImage, validRegion);

- workingImage is the input image

- however, valid region is the largest possible region, which
   is 512 x 512 x 183 in contrast to 512 x 512 x 182


As a first workaround, I simply set the input requested region to
the largest possible region, which resolved the problem.

Thank you very much!

Best regards,
Andreas



More information about the Insight-users mailing list