[Insight-developers] Registration Valgrind Issues: itkVectorResampleImageFilter.hxx, UMR m_DefaultPixelValue

brian avants stnava at gmail.com
Sun Aug 14 11:16:33 EDT 2011


hi luis

jeff duda has been working on this and what you found is clearly a
bug, of course.

we had a similar issue in the linear interpolator and, if i am
recalling correctly, the solution you propose:

> m_DefaultPixelValue = NumericTraits< PixelType >::ZeroValue(
> m_DefaultPixelValue );

does something reasonable.   but with variable length vectors, the
issue is that we do not know the size of the vector until run time.
in the case of the linear interpolator, we were able to identify this
through a 'trick' using the boolean firstOverlap (which senses that
it's the first pixel we've seen and thus stores the value):

from ITK//Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.hxx

      if( firstOverlap )
        {
        // Performing the first assignment of value like this allows
        // VariableLengthVector type to be resized properly.
        value = static_cast< RealType >
          ( this->GetInputImage()->GetPixel(neighIndex) ) * overlap;
        firstOverlap = false;
        }

this allowed us to have a linear interpolator that worked on both
scalar and variable length vector images.

not sure if it's relevant here as well but it could be -  i.e. we
could allow the default pixel value to be unknown until we actually
have a pixel ... then we could fill it with a zero vector of the
correct size.   of course, this assumes the size is constant across
the image.


brian


More information about the Insight-developers mailing list