Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #ifndef mitkVnlVectorCaster_h
17 #define mitkVnlVectorCaster_h
18 
19 #include <vnl/vnl_vector.h>
20 #include <mitkObservable.h>
21 #include <mitkAlgorithm.h>
22 
23 namespace mitk
24 {
29  template <class T, class R>
31  virtual public Algorithm
32  {
33  public:
38  const vnl_vector<T>* _InputVector,
39  vnl_vector<R>* _OutputVector):
40  m_InputVector(_InputVector),
41  m_OutputVector(_OutputVector)
42  {
43  }
44 
48  static void Update(
49  const vnl_vector<T>& _InputVector,
50  vnl_vector<R>& _OutputVector)
51  {
52  for( size_t i=0; i<_InputVector.size(); ++i )
53  _OutputVector[i] = static_cast<R>( _InputVector[i] );
54  }
55 
59  void Update()
60  {
61  Update( *m_InputVector, *m_OutputVector );
62  }
63  private:
67  const vnl_vector<T>* m_InputVector;
71  vnl_vector<R>* m_OutputVector;
72  };
73 } // namespace mitk
74 
75 #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)