[Insight-users] Applying a transform to a VariableLengthVector/VectorImage pixels

Cory Quammen cquammen at cs.unc.edu
Thu Oct 21 22:22:33 EDT 2010


> I am trying to apply a transform (rotation) to every pixel in a (2D)
> VectorImage:
> typedef itk::VectorImage<float, 2>  ImageType;
> I found that itkRigid2DTransform::TransformVector operates on
> itk::Vector<double, 2> VectorType;
> but it complains if I pass it a pixel of the VectorImage, which is a
> VariableLengthVector (but length 2, of course).
> Is there a way to apply a transformation to a VariableLengthVector directly?
> Or is it necessary to convert it to a itk::Vector of the appropriate fixed
> size first? Even better, is there a filter to apply this transform to every
> pixel in the VectorImage directly (without iterating over the pixels
> manually)?
> Thanks,
>
> David
>

David,

You should be able to use an itk::UnaryFunctorImageFilter with a
custom-defined functor that performs the rotation. This will at least
save you from iterating manually over the pixels.

Hope that helps,
Cory


More information about the Insight-users mailing list