18 #ifndef itkCovariantVector_h
19 #define itkCovariantVector_h
23 #include "vnl/vnl_vector_ref.h"
66 template<
typename T,
unsigned int NVectorDimension = 3 >
83 itkStaticConstMacro(
Dimension,
unsigned int, NVectorDimension);
93 {
return NVectorDimension; }
96 void SetVnlVector(
const vnl_vector< T > &);
99 vnl_vector_ref< T > GetVnlVector();
102 vnl_vector< T > GetVnlVector()
const;
106 itkLegacyMacro(
void Set_vnl_vector(
const vnl_vector< T > &));
110 itkLegacyMacro(vnl_vector_ref< T > Get_vnl_vector(
void));
114 itkLegacyMacro(vnl_vector< T > Get_vnl_vector(
void)
const);
126 template<
typename TVectorValueType >
133 template<
typename Tt >
136 BaseArray::operator=(v);
147 template<
typename Tt >
150 for (
unsigned int i = 0; i < NVectorDimension; i++ )
152 ( *this )[i] =
static_cast< ValueType >( ( *this )[i] * value );
159 template<
typename Tt >
162 for (
unsigned int i = 0; i < NVectorDimension; i++ )
164 ( *this )[i] =
static_cast< ValueType >( ( *this )[i] / value );
171 const Self & operator+=(
const Self & vec);
174 const Self & operator-=(
const Self & vec);
202 for (
unsigned int i = 0; i < NVectorDimension; i++ )
204 result[i] =
static_cast< ValueType >( ( *this )[i] * val );
211 template<
typename Tt >
216 for (
unsigned int i = 0; i < NVectorDimension; i++ )
218 result[i] =
static_cast< ValueType >( ( *this )[i] / val );
224 RealValueType GetNorm()
const;
230 RealValueType Normalize();
233 RealValueType GetSquaredNorm()
const;
237 template<
typename TCoordRepB >
240 for (
unsigned int i = 0; i < NVectorDimension; i++ )
242 ( *this )[i] =
static_cast< T
>( pa[i] );
250 template<
typename T,
unsigned int NVectorDimension >
252 CovariantVector< T, NVectorDimension >
255 return v.operator*(scalar);
260 template<
typename T,
unsigned int NVectorDimension >
265 return covariant.operator*( contravariant );
272 ITKCommon_EXPORT
void CrossProduct(CovariantVector< float, 3 > &,
273 const Vector< float, 3 > &,
274 const Vector< float, 3 > &);
276 ITKCommon_EXPORT
void CrossProduct(CovariantVector< int, 3 >,
277 const Vector< int, 3 > &,
278 const Vector< int, 3 > &);
291 #ifndef ITK_MANUAL_INSTANTIATION
292 #include "itkCovariantVector.hxx"
void CastFrom(const CovariantVector< TCoordRepB, NVectorDimension > &pa)
Self & operator=(const Tt &v)
ConstNeighborhoodIterator< TImage > operator-(const ConstNeighborhoodIterator< TImage > &it, const typename ConstNeighborhoodIterator< TImage >::OffsetType &ind)
const Self & operator/=(const Tt &value)
Self operator*(const ValueType &val) const
CovariantVector< T, NVectorDimension > operator*(const T &scalar, const CovariantVector< T, NVectorDimension > &v)
FixedArray< T, NVectorDimension > BaseArray
NumericTraits< ValueType >::RealType RealValueType
CovariantVector(const ValueType r[Dimension])
Simulate a standard C array with copy semnatics.
CovariantVector(const CovariantVector< TVectorValueType, NVectorDimension > &r)
A templated class holding a n-Dimensional vector.
ConstNeighborhoodIterator< TImage > operator+(const ConstNeighborhoodIterator< TImage > &it, const typename ConstNeighborhoodIterator< TImage >::OffsetType &ind)
ITKCommon_EXPORT void CrossProduct(CovariantVector< double, 3 > &, const Vector< double, 3 > &, const Vector< double, 3 > &)
const unsigned int Dimension
Self operator/(const Tt &val) const
FixedArray< T, NVectorDimension > Superclass
static unsigned int GetNumberOfComponents()
A templated class holding a n-Dimensional covariant vector.
const Self & operator*=(const Tt &value)
static unsigned int GetCovariantVectorDimension()