[ITK] [ITK-users] reading images of vectors with variable length in addition to scalar, RGB, RGBA (itkVectorGradientMagnitudeImageFilter)

Grothausmann, Roman Dr. grothausmann.roman at mh-hannover.de
Tue May 10 08:27:04 EDT 2016


Got it working with Kris' help, adding another template level to set fixed 
NumberOfComponentsPerPixel, which is needed because 
VectorGradientMagnitudeImageFilter cannot handle VariableLengthVector (which is 
also used by VectorImage):
https://github.com/romangrothausmann/ITK-CLIs/commit/75bf503a923b408e7b9a229d123b797c3765dc85

On 09/05/16 16:21, Grothausmann, Roman Dr. wrote:
> Dear mailing list members,
>
>
> Based on Bill's feedback I created a template.cxx
> (https://github.com/romangrothausmann/ITK-CLIs/blob/master/template.cxx) that I
> just extend according to some ITK-filters when needed. In general it works well
> for images of varying dimension and for scalar, often even for RGB and RGBA types.
> However, now I'm in the need to apply itkVectorGradientMagnitudeImageFilter to
> images of vectors with lengths 2 to 5 for which my approach with
> VariableLengthVector does not work.
>
> gradient_mag_vec.cxx
> (https://github.com/romangrothausmann/ITK-CLIs/blob/master/gradient_mag_vec.cxx)
> is based on template.cxx (diff:
> https://github.com/romangrothausmann/ITK-CLIs/commit/544345b259adce2ef903183553a1aa97648e85b8)
>
> with dim= 1 and scalar removed (because not supported by
> itkVectorGradientMagnitudeImageFilter).
> gradient_mag_vec.cxx compiles fine if complex and vector are commented out but
> for e.g. RGB yields outputs where the last DimSize is 3* the input DimSize.
>
> Including vector compilation aborts with complains like:
>
> itkVectorGradientMagnitudeImageFilter.h:184:62: error: ?Dimension? is not a
> member of ?itk::Image<itk::VariableLengthVector<double>, 3u>::PixelType {aka
> itk::VariableLengthVector<double>}?
>     typedef typename ConstNeighborhoodIteratorType::RadiusType RadiusType;
>
> What would I have to change to make this work for images composed of vectors
> with e.g. 2 to 5 elements?
> Would that also solve the incorrect output for RGB/RGBA?
> Is there any elegant way to circumvent using GetNumberOfComponentsPerPixel to
> instantiate another template level in case a vector image is detected?
>
> Many thanks for any help or hints.
> Roman
>

-- 
Dr. Roman Grothausmann

Tomographie und Digitale Bildverarbeitung
Tomography and Digital Image Analysis

Institut für Funktionelle und Angewandte Anatomie, OE 4120
Medizinische Hochschule Hannover
Carl-Neuberg-Str. 1
D-30625 Hannover

Tel. +49 511 532-2900
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list