00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkScalarVector.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/01/15 18:57:17 $ 00007 Version: $Revision: 1.15 $ 00008 00009 Copyright (c) 2002 Insight Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkScalarVector_h 00018 #define __itkScalarVector_h 00019 00020 #include "itkMacro.h" 00021 #include "vnl/vnl_vector_fixed.h" 00022 00023 #include <memory> 00024 00025 namespace itk 00026 { 00027 00057 template<class TScalar, class TVector, unsigned int TVectorDimension=3> 00058 class ScalarVector { 00059 public: 00061 typedef ScalarVector Self; 00062 00065 typedef TScalar ValueType; 00066 00069 typedef TScalar ScalarValueType; 00070 00073 typedef TVector VectorValueType; 00074 00077 typedef vnl_vector_fixed<TVector, TVectorDimension> VectorType; 00078 00080 TScalar GetScalar() const 00081 { return m_Scalar; } 00082 00084 void SetScalar(const TScalar &val) 00085 { m_Scalar = val; } 00086 00088 static unsigned int GetVectorDimension() 00089 { return TVectorDimension; } 00090 00093 const VectorType &GetVector() const 00094 { return m_Vector; } 00095 00098 VectorType &GetVector() 00099 { return m_Vector; } 00100 00102 void SetVector(const VectorType &vec) 00103 { m_Vector = vec; } 00104 00105 private: 00106 TScalar m_Scalar; 00107 VectorType m_Vector; 00108 }; 00109 00110 00111 } // end namespace itk 00112 00113 #endif