ITK  4.3.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 #if !defined( ITK_LEGACY_REMOVE )
21 
22 #include "itkMacro.h"
23 #include "vnl/vnl_vector_fixed.h"
24 
25 #include <memory>
26 
27 namespace itk
28 {
60 template< class TScalar, class TVector, unsigned int TVectorDimension = 3 >
61 class ITK_EXPORT ScalarVector
62 {
63 public:
65  typedef ScalarVector Self;
66 
69  typedef TScalar ValueType;
70 
73  typedef TScalar ScalarValueType;
74 
77  typedef TVector VectorValueType;
78 
81  typedef vnl_vector_fixed< TVector, TVectorDimension > VectorType;
82 
84  TScalar GetScalar() const
85  { return m_Scalar; }
86 
88  void SetScalar(const TScalar & val)
89  { m_Scalar = val; }
90 
92  static unsigned int GetVectorDimension()
93  { return TVectorDimension; }
94 
97  const VectorType & GetVector() const
98  { return m_Vector; }
99 
102  VectorType & GetVector()
103  { return m_Vector; }
104 
106  void SetVector(const VectorType & vec)
107  { m_Vector = vec; }
108 
109 private:
110  TScalar m_Scalar;
111  VectorType m_Vector;
112 };
113 } // end namespace itk
114 
115 #endif //#if !defined( ITK_LEGACY_REMOVE )
116 #endif
117