ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkScalarVector.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkScalarVector_h
19 #define __itkScalarVector_h
20 
21 #include "itkMacro.h"
22 #include "vnl/vnl_vector_fixed.h"
23 
24 #include <memory>
25 
26 namespace itk
27 {
58 template< class TScalar, class TVector, unsigned int TVectorDimension = 3 >
59 class ITK_EXPORT ScalarVector
60 {
61 public:
63  typedef ScalarVector Self;
64 
67  typedef TScalar ValueType;
68 
71  typedef TScalar ScalarValueType;
72 
75  typedef TVector VectorValueType;
76 
79  typedef vnl_vector_fixed< TVector, TVectorDimension > VectorType;
80 
82  TScalar GetScalar() const
83  { return m_Scalar; }
84 
86  void SetScalar(const TScalar & val)
87  { m_Scalar = val; }
88 
90  static unsigned int GetVectorDimension()
91  { return TVectorDimension; }
92 
95  const VectorType & GetVector() const
96  { return m_Vector; }
97 
100  VectorType & GetVector()
101  { return m_Vector; }
102 
104  void SetVector(const VectorType & vec)
105  { m_Vector = vec; }
106 private:
107  TScalar m_Scalar;
109 };
110 } // end namespace itk
111 
112 #endif
113