Medical Imaging Interaction Toolkit  2023.04.00
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
mitk::VnlVectorCaster::Update
static void Update(const vnl_vector< T > &_InputVector, vnl_vector< R > &_OutputVector)
Definition: mitkVnlVectorCaster.h:44
mitk::VnlVectorCaster::Update
void Update()
Definition: mitkVnlVectorCaster.h:55
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::VnlVectorCaster::VnlVectorCaster
VnlVectorCaster(const vnl_vector< T > *_InputVector, vnl_vector< R > *_OutputVector)
Definition: mitkVnlVectorCaster.h:33
mitkObservable.h
mitk::VnlVectorCaster
Definition: mitkVnlVectorCaster.h:26
mitk::Algorithm
Definition: mitkAlgorithm.h:22
mitkAlgorithm.h