ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkScalarVector.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkScalarVector_h
00019 #define __itkScalarVector_h
00020 
00021 #include "itkMacro.h"
00022 #include "vnl/vnl_vector_fixed.h"
00023 
00024 #include <memory>
00025 
00026 namespace itk
00027 {
00058 template< class TScalar, class TVector, unsigned int TVectorDimension = 3 >
00059 class ITK_EXPORT ScalarVector
00060 {
00061 public:
00063   typedef ScalarVector Self;
00064 
00067   typedef TScalar ValueType;
00068 
00071   typedef TScalar ScalarValueType;
00072 
00075   typedef TVector VectorValueType;
00076 
00079   typedef vnl_vector_fixed< TVector, TVectorDimension > VectorType;
00080 
00082   TScalar GetScalar() const
00083   { return m_Scalar; }
00084 
00086   void SetScalar(const TScalar & val)
00087   { m_Scalar = val; }
00088 
00090   static unsigned int GetVectorDimension()
00091   { return TVectorDimension; }
00092 
00095   const VectorType & GetVector() const
00096   { return m_Vector; }
00097 
00100   VectorType & GetVector()
00101   { return m_Vector; }
00102 
00104   void SetVector(const VectorType & vec)
00105   { m_Vector = vec; }
00106 private:
00107   TScalar    m_Scalar;
00108   VectorType m_Vector;
00109 };
00110 } // end namespace itk
00111 
00112 #endif
00113