[Insight-developers] using VectorInterpolateImageFunction with images of CovariantVectors

Luis Ibanez luis.ibanez@kitware.com
Tue, 12 Nov 2002 16:51:10 -0500


Hi Josh,


The second change looks just fine.
(using FixedArray instead of Vector for accessing the Traits).


The first probably need to be a bit different since types are not 
inherited on the SGI's. In principle from the Vector we don't have
access to the "Length" defined in the FixedArray. We will have to
explicitly ask for  the Superclass type instead of T::
something like

itkStaticConstMacro(VectorDimension,int,SuperClass::Length);


How about just calling it just "Dimension",
like

  itkStaticConstMacro( Dimension, int, SuperClass::Length );

in Vector, CovariantVector and RGBPixel   ?



Luis



========================================================================


Joshua Cates wrote:

> Hi Luis,
> 
> Sorry, my email was not very clear. What I'm after is the functionality
> you refer to in the second half of your email: support for all
> FixedArrays.  I happen to be using CovariantVectors in my particular
> application, but I need to represent them and interpolate as FixedArrays
> in a parent class.  
> 
> Can't we just change 
> 
> template <typename T>
> struct GetVectorDimension
> {
>   itkStaticConstMacro(VectorDimension, int, T::VectorDimension);
> }; 
> 
> 
> to 
> 
> template <typename T>
> struct GetVectorDimension
> {
>   itkStaticConstMacro(VectorDimension, int, T::Length);
> }; 
> 
> 
> and
> 
> 
> class ITK_EXPORT VectorInterpolateImageFunction : 
>   public ImageFunction<
>     TInputImage, 
>     Vector< ITK_TYPENAME NumericTraits<typename 
> TPixelType::ValueType>::RealType, 
>       ::itk::GetVectorDimension<TPixelType>::VectorDimension>,
>     TCoordRep > 
> 
> 
> to 
> 
> 
> class ITK_EXPORT VectorInterpolateImageFunction : 
>   public ImageFunction<
>     TInputImage, 
>     FixedArray< ITK_TYPENAME NumericTraits<typename 
> TPixelType::ValueType>::RealType, 
>       ::itk::GetVectorDimension<TPixelType>::VectorDimension>,
>     TCoordRep > 
> 
> 
> 
> 
> Josh.
> 
> ______________________________
>  Josh Cates			
>  School of Computer Science	
>  University of Utah
>  Email: cates@sci.utah.edu
>  Phone: (801) 587-7697
>  URL:   www.cs.utk.edu/~cates
> 
> 
> On Tue, 12 Nov 2002, Luis Ibanez wrote:
> 
> 
>>
>>Hi Josh,
>>
>>The itk::CovariantVector class was recently modified in order
>>to make possible its use with the VectorInterpolateImageFunction.
>>( this happened on 10/23/02 )
>>
>>
>>The difficulty was that VectorInterpolateImageFunction access
>>the dimension as "VectorDimension" but the CovariantVector
>>used to call its dimension = "CovariantVectorDimension".
>>
>>The header was then changed to make this "VectorDimension".
>>
>>
>>It should be working now....
>>are you testing this with a recent checkout ?
>>
>>
>>As you said, it is easy to generalize the VectorInterpolator
>>to accept any Array (actually FixedArray). It will be a matter
>>of deciding how to name the Dimension.
>>
>>Vector and CovariantVector derive both from FixedArray.
>>
>>FixedArray calls its dimension "Length". We could add
>>another enum ( / static int) to have a "Dimension"
>>that could be used by the interpolator.
>>
>>
>>BTW that will be quite helpful with a pending problem
>>we have in the registration framework. Currently we
>>cannot register RGB images. The first obstacle for
>>this type of registration is the lack of interpolators
>>that can act on RGBpixels. (the second obstacle is the
>>lack of image metrics).
>>
>>Conveniently RGBPixel<> already derives from FixedArray,
>>so generalizing the VectorInterpolateImageFunction to
>>accept FixedArrays will solve both problems.
>>
>>
>>Does anybody see a possible conflict with these changes ?
>>
>>
>>     Luis
>>
>>
>>
>>=====================================================
>>
>>Joshua Cates wrote:
>>
>>
>>>Hi,
>>>
>>>There seems to be no way to use the VectorInterpolateImageFunction
>>>subclasses with images of CovariantVectors (FixedArrays), i.e. the output 
>>>of GradientImageFilter.  Does anyone have a workaround for this?
>>>
>>>At first glance, looks like VectorInterpolateImageFunction could be
>>>rewritten to accept any FixedArray, instead of limiting to just
>>>itk::Vector.  It could then support itk::Vector and itk::CovariantVector.
>>>
>>>Thanks,
>>>
>>>Josh.
>>>
>>>______________________________
>>> Josh Cates			
>>> School of Computer Science	
>>> University of Utah
>>> Email: cates@sci.utah.edu
>>> Phone: (801) 587-7697
>>> URL:   www.cs.utk.edu/~cates
>>>
>>>
>>>
>>>_______________________________________________
>>>Insight-developers mailing list
>>>Insight-developers@public.kitware.com
>>>http://public.kitware.com/mailman/listinfo/insight-developers
>>>
>>>
>>>
>>
>>
> 
>