[Insight-developers] Bug in ImageFunction causing incorrect results from ResampleImageFilter
Blezek, Daniel J., Ph.D.
Blezek.Daniel at mayo.edu
Mon Jun 2 12:10:20 EDT 2008
I have some fairly thick CT slices (5mm) that I would like to resample
to be isotropic. A straightforward use of ResampleImageFilter leaves 4
blank slices in the output volume. I've tracked this down to a bug(?)
in ImageFunction. This code is incorrect IMHO:
virtual bool IsInsideBuffer( const ContinuousIndexType & index ) const
{
for ( unsigned int j = 0; j < ImageDimension; j++ )
{
if ( index[j] < m_StartContinuousIndex[j] ) { return false; };
if ( index[j] > m_EndContinuousIndex[j] ) { return false; };
}
return true;
}
(Dealing with Z in 3D) This code assumes the last slice has zero
thickness. For N slices, the range where IsInsideBuffer returns true is
[0, N-1). This is incorrect, the correct result should be [0, N). [0,
N) gives the last slice it's proper thickness. The windowed Sinc
interpolator properly handles the last slice, i.e. [N-1, N), but I have
not checked others. A proper implementation would look like this (note
the vcl_floor calls):
if ( vcl_floor(index[j]) < m_StartContinuousIndex[j] ) {
return false; };
if ( vcl_floor(index[j]) > m_EndContinuousIndex[j] ) { return
false; };
I've run all the tests on a fresh check out with the above change. As
may be expected, almost all of the registration tests fail, while most
of the resample tests pass. Surprisingly,
ResampleVolumesToBeIsotropicTest passed...
Any comments on this bug? Should the tests be made to accommodate the
change, or should I override the method in a custom interpolator?
Regards,
-dan
Daniel Blezek, PhD
Medical Imaging Informatics Innovation Center
Enterprise Imaging Systems Unit
P 127 or (77) 8 8886
T 507 538 8886
E blezek.daniel at mayo.edu
Mayo Clinic
200 First St. S.W.
Harwick SL-44
Rochester, MN 55905
mayoclinic.org
More information about the Insight-developers
mailing list