[Insight-developers] vectorimage linear interpolation
brian avants
stnava at gmail.com
Fri Mar 11 09:05:55 EST 2011
hi everyone
i'm putting together a registration metric for VectorImages and the
code reuse from the scalar image metric is very high. which is great.
except there is a small hang up with the
LinearInterpolateImageFunction.
i am defining:
typedef itk::VectorImage< float,ImageDimension > ImageType;
and
typedef LinearInterpolateImageFunction< FixedImageType,
CoordinateRepresentationType > FixedInterpolatorType;
relevant code from that function is:
/**
* Interpolated value is the weighted sum of each of the surrounding
* neighbors. The weight for each neighbor is the fraction overlap
* of the neighbor pixel with respect to a pixel centered on point.
*/
RealType value= NumericTraits< RealType >::Zero;
so, if i compile with the original code in place, i get this error :
itkLinearInterpolateImageFunction.txx:89: error: invalid conversion
from ‘const itk::VariableLengthVector<double> (*)(const
itk::VariableLengthVector<double>&)’ to ‘unsigned int’
/Users/brianavants/code/ITKv4/ITK/Code/Common/itkLinearInterpolateImageFunction.txx:89:
error: initializing argument 1 of
‘itk::VariableLengthVector<TValueType>::VariableLengthVector(unsigned
int) [with TValueType = double]’
the Zero function is defined in
Common/itkNumericTraitsVariableLengthVectorPixel.h
if i replace
RealType value= NumericTraits< RealType >::Zero;
with
RealType value; value.Fill(0);
then all is well for the VectorImage case but this does not work
(obviously) in the scalar image case. so, it's this one line / one
definition that is causing the hang up. i am hoping someone with more
familiarity with NumericTraits might point me to the right solution
i.e. the solution that would let me use the
LinearInterpolateImageFunction in this context.
for reference, the variable length vector Zero implementation:
static const Self Zero(const Self & a)
{
Self b( a.Size() );
b.Fill(NumericTraits< T >::Zero);
return b;
}
from Common/itkNumericTraitsVariableLengthVectorPixel.h .... any help
is appreciated.
brian
More information about the Insight-developers
mailing list