[Insight-users] Computing the gradient of a vector image

David Doria daviddoria at gmail.com
Fri Dec 3 14:20:36 EST 2010


I have an image of type:

typedef itk::CovariantVector<float, 2> VectorType;
typedef itk::Image<VectorType, 2>   VectorImageType;

that I need to compute the gradient of.

I tried this:

  typedef itk::GradientImageFilter<
      VectorImageType, VectorType>  GradientFilterType;
  GradientFilterType::Pointer gradientFilter = GradientFilterType::New();

but I get concept checking errors like:

itkConceptChecking.h:185: error: invalid static_cast from type
‘itk::CovariantVector<float, 2u>’ to type ‘float’

There should be no problem subtracting two vectors to produce an
output vector (of vectors) as the gradient right? I.e. the first
component of the output (gradient in x direction) should be a vector,
the second component of the output should be another vector (gradient
in the y direction), etc.

Here is what I tried:
http://www.itk.org/Wiki/ITK/Examples/Broken/ImageProcessing/GradientOfVectorImage

Is there a reason that this isn't allowed?

David


More information about the Insight-users mailing list