Medical Imaging Interaction Toolkit  2021.10.99-1c4db16f
Medical Imaging Interaction Toolkit
mitkVnlVectorCaster.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 #ifndef mitkVnlVectorCaster_h
13 #define mitkVnlVectorCaster_h
14 
15 #include <vnl/vnl_vector.h>
16 #include <mitkObservable.h>
17 #include <mitkAlgorithm.h>
18 
19 namespace mitk
20 {
25  template <class T, class R>
27  virtual public Algorithm
28  {
29  public:
34  const vnl_vector<T>* _InputVector,
35  vnl_vector<R>* _OutputVector):
36  m_InputVector(_InputVector),
37  m_OutputVector(_OutputVector)
38  {
39  }
40 
44  static void Update(
45  const vnl_vector<T>& _InputVector,
46  vnl_vector<R>& _OutputVector)
47  {
48  for( size_t i=0; i<_InputVector.size(); ++i )
49  _OutputVector[i] = static_cast<R>( _InputVector[i] );
50  }
51 
55  void Update()
56  {
57  Update( *m_InputVector, *m_OutputVector );
58  }
59  private:
63  const vnl_vector<T>* m_InputVector;
67  vnl_vector<R>* m_OutputVector;
68  };
69 } // namespace mitk
70 
71 #endif // mitkVnlVectorCaster_h
DataCollection - Class to facilitate loading/accessing structured data.
static void Update(const vnl_vector< T > &_InputVector, vnl_vector< R > &_OutputVector)
VnlVectorCaster(const vnl_vector< T > *_InputVector, vnl_vector< R > *_OutputVector)