Medical Imaging Interaction Toolkit  2023.12.99-63768887
Medical Imaging Interaction Toolkit
mitkVectorDeprecated.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkVectorDeprecated_h
14 #define mitkVectorDeprecated_h
15 
16 #include <itkIndex.h>
17 #include <vnl/vnl_quaternion.h>
18 
19 #include "mitkMatrix.h"
20 #include "mitkNumericConstants.h"
21 #include "mitkPoint.h"
22 #include "mitkVector.h"
23 
24 template <class T>
26 {
27 public:
28  typedef T ValueType;
29 };
30 
31 template <>
33 {
34 public:
36 };
37 
38 template <>
39 class VectorTraits<float[4]>
40 {
41 public:
42  typedef float ValueType;
43 };
44 
45 template <>
46 class VectorTraits<itk::Index<5>>
47 {
48 public:
49  typedef itk::Index<5>::IndexValueType ValueType;
50 };
51 
52 template <>
53 class VectorTraits<itk::Index<3>>
54 {
55 public:
56  typedef itk::Index<3>::IndexValueType ValueType;
57 };
58 template <>
59 class VectorTraits<itk::SizeValueType[3]>
60 {
61 public:
62  typedef itk::SizeValueType ValueType;
63 };
64 template <>
65 class VectorTraits<itk::IndexValueType[3]>
66 {
67 public:
68  typedef itk::IndexValueType ValueType;
69 };
70 template <>
71 class VectorTraits<unsigned int[3]>
72 {
73 public:
74  typedef unsigned int ValueType;
75 };
76 template <>
77 class VectorTraits<float[3]>
78 {
79 public:
80  typedef float ValueType;
81 };
82 template <>
83 class VectorTraits<double[3]>
84 {
85 public:
86  typedef double ValueType;
87 };
88 
89 template <>
90 class VectorTraits<vnl_vector_fixed<mitk::ScalarType, 3>>
91 {
92 public:
94 };
95 
96 template <>
97 class VectorTraits<unsigned int *>
98 {
99 public:
100  typedef unsigned int ValueType;
101 };
102 
103 template <>
104 class VectorTraits<double[4]>
105 {
106 public:
107  typedef double ValueType;
108 };
109 
110 template <>
111 class VectorTraits<itk::Vector<float, 3>>
112 {
113 public:
114  typedef float ValueType;
115 };
116 
117 template <>
118 class VectorTraits<itk::Vector<double, 3>>
119 {
120 public:
121  typedef double ValueType;
122 };
123 
124 template <>
125 class VectorTraits<itk::Vector<int, 3>>
126 {
127 public:
128  typedef int ValueType;
129 };
130 
131 template <>
132 class VectorTraits<mitk::Vector<double, 3>>
133 {
134 public:
135  typedef double ValueType;
136 };
137 
138 template <>
139 class VectorTraits<mitk::Point<float, 3>>
140 {
141 public:
142  typedef float ValueType;
143 };
144 
145 template <>
146 class VectorTraits<mitk::Point<float, 4>>
147 {
148 public:
149  typedef float ValueType;
150 };
151 
152 template <>
153 class VectorTraits<itk::Point<float, 3>>
154 {
155 public:
156  typedef float ValueType;
157 };
158 
159 template <>
160 class VectorTraits<itk::Point<float, 4>>
161 {
162 public:
163  typedef float ValueType;
164 };
165 
166 template <>
167 class VectorTraits<mitk::Point<double, 3>>
168 {
169 public:
170  typedef double ValueType;
171 };
172 
173 template <>
174 class VectorTraits<mitk::Point<double, 4>>
175 {
176 public:
177  typedef double ValueType;
178 };
179 
180 template <>
181 class VectorTraits<itk::Point<double, 3>>
182 {
183 public:
184  typedef double ValueType;
185 };
186 
187 template <>
188 class VectorTraits<itk::Point<double, 4>>
189 {
190 public:
191  typedef double ValueType;
192 };
193 
194 template <>
195 class VectorTraits<mitk::Point<int, 3>>
196 {
197 public:
198  typedef int ValueType;
199 };
200 
201 namespace mitk
202 {
203  template <class Tin, class Tout>
204  inline void itk2vtk(const Tin &in, Tout &out)
205  {
206  out[0] = (typename VectorTraits<Tout>::ValueType)(in[0]);
207  out[1] = (typename VectorTraits<Tout>::ValueType)(in[1]);
208  out[2] = (typename VectorTraits<Tout>::ValueType)(in[2]);
209  }
210 
211  template <class Tin, class Tout>
212  inline void vtk2itk(const Tin &in, Tout &out)
213  {
214  out[0] = (typename VectorTraits<Tout>::ValueType)(in[0]);
215  out[1] = (typename VectorTraits<Tout>::ValueType)(in[1]);
216  out[2] = (typename VectorTraits<Tout>::ValueType)(in[2]);
217  }
218 
219  template <class Tin, class Tout>
220  inline void vnl2vtk(const vnl_vector<Tin> &in, Tout *out)
221  {
222  unsigned int i;
223  for (i = 0; i < in.size(); ++i)
224  out[i] = (Tout)(in[i]);
225  }
226 
227  template <class Tin, class Tout>
228  inline void vtk2vnl(const Tin *in, vnl_vector<Tout> &out)
229  {
230  unsigned int i;
231  for (i = 0; i < out.size(); ++i)
232  out[i] = (Tout)(in[i]);
233  }
234 
235  template <class Tin, class Tout, unsigned int n>
236  inline void vnl2vtk(const vnl_vector_fixed<Tin, n> &in, Tout *out)
237  {
238  unsigned int i;
239  for (i = 0; i < in.size(); ++i)
240  out[i] = (Tout)(in[i]);
241  }
242 
243  template <class Tin, class Tout, unsigned int n>
244  inline void vtk2vnl(const Tin *in, vnl_vector_fixed<Tout, n> &out)
245  {
246  unsigned int i;
247  for (i = 0; i < out.size(); ++i)
248  out[i] = (Tout)(in[i]);
249  }
250 
251  template <typename U, typename V, unsigned int NRows, unsigned int NColumns>
252  inline void TransferMatrix(const itk::Matrix<U, NRows, NColumns> &in, itk::Matrix<V, NRows, NColumns> &out)
253  {
254  for (unsigned int i = 0; i < in.RowDimensions; ++i)
255  for (unsigned int j = 0; j < in.ColumnDimensions; ++j)
256  out[i][j] = in[i][j];
257  }
258 
259 #define mitkSetConstReferenceMacro(name, type) \
260  virtual void Set##name(const type &_arg) \
261  { \
262  itkDebugMacro("setting " << #name " to " << _arg); \
263  if (this->m_##name != _arg) \
264  { \
265  this->m_##name = _arg; \
266  this->Modified(); \
267  } \
268  }
269 
270 #define mitkSetVectorMacro(name, type) mitkSetConstReferenceMacro(name, type)
271 
272 #define mitkGetVectorMacro(name, type) itkGetConstReferenceMacro(name, type)
273 
274 } // namespace mitk
275 
276 #endif
VectorTraits< itk::Vector< float, 3 > >::ValueType
float ValueType
Definition: mitkVectorDeprecated.h:114
VectorTraits::ValueType
T ValueType
Definition: mitkVectorDeprecated.h:28
mitk::vtk2vnl
void vtk2vnl(const Tin *in, vnl_vector< Tout > &out)
Definition: mitkVectorDeprecated.h:228
VectorTraits< unsigned int[3]>::ValueType
unsigned int ValueType
Definition: mitkVectorDeprecated.h:74
VectorTraits< itk::Point< double, 3 > >::ValueType
double ValueType
Definition: mitkVectorDeprecated.h:184
VectorTraits< mitk::Point< double, 4 > >::ValueType
double ValueType
Definition: mitkVectorDeprecated.h:177
mitkPoint.h
VectorTraits< itk::SizeValueType[3]>::ValueType
itk::SizeValueType ValueType
Definition: mitkVectorDeprecated.h:62
VectorTraits< itk::Point< float, 3 > >::ValueType
float ValueType
Definition: mitkVectorDeprecated.h:156
mitkMatrix.h
mitk::VnlVector
vnl_vector< ScalarType > VnlVector
Definition: mitkVector.h:159
mitk::TransferMatrix
void TransferMatrix(const itk::Matrix< U, NRows, NColumns > &in, itk::Matrix< V, NRows, NColumns > &out)
Definition: mitkVectorDeprecated.h:252
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::vtk2itk
void vtk2itk(const Tin &in, Tout &out)
Definition: mitkVectorDeprecated.h:212
VectorTraits
Definition: mitkVectorDeprecated.h:25
VectorTraits< itk::Point< float, 4 > >::ValueType
float ValueType
Definition: mitkVectorDeprecated.h:163
VectorTraits< itk::Vector< double, 3 > >::ValueType
double ValueType
Definition: mitkVectorDeprecated.h:121
VectorTraits< mitk::Point< float, 3 > >::ValueType
float ValueType
Definition: mitkVectorDeprecated.h:142
VectorTraits< mitk::Point< float, 4 > >::ValueType
float ValueType
Definition: mitkVectorDeprecated.h:149
VectorTraits< itk::Point< double, 4 > >::ValueType
double ValueType
Definition: mitkVectorDeprecated.h:191
VectorTraits< vnl_vector_fixed< mitk::ScalarType, 3 > >::ValueType
mitk::ScalarType ValueType
Definition: mitkVectorDeprecated.h:93
VectorTraits< double[4]>::ValueType
double ValueType
Definition: mitkVectorDeprecated.h:107
mitkNumericConstants.h
mitk::itk2vtk
void itk2vtk(const Tin &in, Tout &out)
Definition: mitkVectorDeprecated.h:204
VectorTraits< float[4]>::ValueType
float ValueType
Definition: mitkVectorDeprecated.h:42
VectorTraits< float[3]>::ValueType
float ValueType
Definition: mitkVectorDeprecated.h:80
itk
SET FUNCTIONS.
Definition: itkIntelligentBinaryClosingFilter.h:30
VectorTraits< itk::IndexValueType[3]>::ValueType
itk::IndexValueType ValueType
Definition: mitkVectorDeprecated.h:68
VectorTraits< mitk::Point< double, 3 > >::ValueType
double ValueType
Definition: mitkVectorDeprecated.h:170
VectorTraits< itk::Index< 3 > >::ValueType
itk::Index< 3 >::IndexValueType ValueType
Definition: mitkVectorDeprecated.h:56
mitkVector.h
VectorTraits< mitk::Point< int, 3 > >::ValueType
int ValueType
Definition: mitkVectorDeprecated.h:198
VectorTraits< mitk::VnlVector >::ValueType
mitk::ScalarType ValueType
Definition: mitkVectorDeprecated.h:35
VectorTraits< itk::Index< 5 > >::ValueType
itk::Index< 5 >::IndexValueType ValueType
Definition: mitkVectorDeprecated.h:49
VectorTraits< itk::Vector< int, 3 > >::ValueType
int ValueType
Definition: mitkVectorDeprecated.h:128
VectorTraits< unsigned int * >::ValueType
unsigned int ValueType
Definition: mitkVectorDeprecated.h:100
mitk::vnl2vtk
void vnl2vtk(const vnl_vector< Tin > &in, Tout *out)
Definition: mitkVectorDeprecated.h:220
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20
VectorTraits< double[3]>::ValueType
double ValueType
Definition: mitkVectorDeprecated.h:86
VectorTraits< mitk::Vector< double, 3 > >::ValueType
double ValueType
Definition: mitkVectorDeprecated.h:135