Medical Imaging Interaction Toolkit  2021.10.99-1c4db16f
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 (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 mitkVnlVectorFromCvMat_h
13 #define mitkVnlVectorFromCvMat_h
14 
15 #include <mitkVnlMatrixFromCvMat.h>
16 #include <vnl/vnl_vector.h>
17 
18 namespace mitk
19 {
23  template <class T>
25  virtual public Algorithm
26  {
27  public:
32  const cv::Mat* _CvMat,
33  vnl_vector<T>* _VnlVector):
34  m_VnlMatrixFromCvMat( _CvMat, &m_VnlMatrix ),
35  m_VnlVector(_VnlVector)
36  {
37  }
38 
42  void Update() override
43  {
44  m_VnlMatrixFromCvMat.Update();
45 
46  if( m_VnlMatrix.rows() == 1 )
47  *m_VnlVector = m_VnlMatrix.get_row(0);
48  else if( m_VnlMatrix.cols() == 1 )
49  *m_VnlVector = m_VnlMatrix.get_column(0);
50 
51  }
52  private:
56  vnl_matrix<T> m_VnlMatrix;
60  VnlMatrixFromCvMat<T> m_VnlMatrixFromCvMat;
64  vnl_vector<T>* m_VnlVector;
65  };
66 } // namespace mitk
67 
68 #endif // mitkVnlVectorFromCvMat_h
DataCollection - Class to facilitate loading/accessing structured data.
VnlVectorFromCvMat(const cv::Mat *_CvMat, vnl_vector< T > *_VnlVector)