[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
Mon May 9 10:21:14 EDT 2016


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


More information about the Insight-users mailing list