[Insight-users] Use GetNumberOfComponents() instead of Dimension

Bryn Lloyd blloyd at bwh.harvard.edu
Fri Aug 19 09:54:51 EDT 2005


Hi again,


Here are some more suggested changes (previous one was for
VectorResampleImageFilter), to make multiple-component-pixel image filters
compatible with all the different types (i.e. Vector, CovariantVector,
SymmetricSecondRankTensor, ...)


This is what should be done:

replace:
   PixelType::Dimension
with:
   PixelType::GetNumberOfComponents()



In the header file of itkVectorExpandImageFilter.h
  /** Determine the vector dimension. */
  enum { VectorDimension = InputPixelType::Dimension };



In itkVectorCastImageFilter.h
    for( unsigned int k = 0; k < TOutput::Dimension; k++ )
      { value[k] = static_cast<OutputValueType>( A[k] ); }
    return value;




In itkVectorInterpolateImageFunction.h
  template <typename T>
  struct GetDimension
  {
    itkStaticConstMacro(Dimension, int, T::Dimension);
  };
AND
  /** Extract the vector dimension from the pixel template parameter. */
  itkStaticConstMacro(Dimension, unsigned int,
                      TPixelType::Dimension);





In itkVectorNeighborhoodInnerProduct.h
  /** Extract the image and vector dimension from the image template
parameter. */
  itkStaticConstMacro(VectorDimension, unsigned int,
                      PixelType::Dimension);




In itk::GetVectorDimension, itkFixedArray.h
  template <typename TVector>
  struct GetVectorDimension
   {
   itkStaticConstMacro(VectorDimension, unsigned int, TVector::Dimension);
   };

This struct (GetVectorDimension) is used at several places. Maybe changing
it could cause some other problems.



It would be really great if some of these changes could be made!


Additionally the itkArray object should maybe have a function 
	GetNumberOfComponents(). With the new itkVectorImage class, this might
help making the filters compatible with this image type.



Thanks

Bryn





More information about the Insight-users mailing list