Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkVnlVectorFromCvMat.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 mitkVnlVectorFromCvMat_h
17 #define mitkVnlVectorFromCvMat_h
18 
19 #include <mitkVnlMatrixFromCvMat.h>
20 #include <vnl/vnl_vector.h>
21 
22 namespace mitk
23 {
27  template <class T>
29  virtual public Algorithm
30  {
31  public:
36  const cv::Mat* _CvMat,
37  vnl_vector<T>* _VnlVector):
38  m_VnlMatrixFromCvMat( _CvMat, &m_VnlMatrix ),
39  m_VnlVector(_VnlVector)
40  {
41  }
42 
46  void Update() override
47  {
48  m_VnlMatrixFromCvMat.Update();
49 
50  if( m_VnlMatrix.rows() == 1 )
51  *m_VnlVector = m_VnlMatrix.get_row(0);
52  else if( m_VnlMatrix.cols() == 1 )
53  *m_VnlVector = m_VnlMatrix.get_column(0);
54 
55  }
56  private:
60  vnl_matrix<T> m_VnlMatrix;
64  VnlMatrixFromCvMat<T> m_VnlMatrixFromCvMat;
68  vnl_vector<T>* m_VnlVector;
69  };
70 } // namespace mitk
71 
72 #endif // mitkVnlVectorFromCvMat_h
DataCollection - Class to facilitate loading/accessing structured data.
VnlVectorFromCvMat(const cv::Mat *_CvMat, vnl_vector< T > *_VnlVector)