[Insight-users] magnitude of each voxel of a vector image

David Doria daviddoria at gmail.com
Mon Jul 4 19:43:34 EDT 2011


On Mon, Jul 4, 2011 at 3:57 PM, Sadegh <sadegh.riyahi at gmail.com> wrote:
> Hi!
> I'm having two problems regarding vector images:
> 1- I am wondering is there any way to obtain the magnitude values of each
> voxel (which is vector type) of a vector image DIRECTLY using iterators?!
> Well. I know that I may have to convert the vector image to a scalar image
> using filters such as "GradientToMagnitudeImageFilter" to have an image of
> gradient magnitude then iterate over it to access to each values of the
> voxels, but I'm looking for a shortcut to directly access it without any
> conversion.
>
> 2- I am wondering why the filter "VectorGradientMagnitudeImageFilter" does
> not accept itk::VectorImage as its input?! it only accepts Vector Type
> images "itk::Vector< float, 3 >      VectorType; itk::Image< VectorType, 3>"
> as its input which is inconvenient sometimes. Or maybe I'm wrong.
>
> Thanks in advance for your answer :)

You can subclass itk::ImageAdaptor to obtain the functionality you're
looking for.

Here is an example - this one simply returns a particular component,
but instead, you could return the magnitude:
http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ImageAdaptorExtractVectorComponent

ITK certainly has a very bad name clash happening regarding
itk::Image<Vector> vs itk::VectorImage. It is never clear from the
name of the filters which input they require.

David


More information about the Insight-users mailing list