Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
mitkVnlMatrixFromCvMat.h
mitk::VnlMatrixFromCvMat
Definition: mitkVnlMatrixFromCvMat.h:27
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::Algorithm
Definition: mitkAlgorithm.h:22
mitk::VnlVectorFromCvMat
Definition: mitkVnlVectorFromCvMat.h:24
mitk::VnlVectorFromCvMat::VnlVectorFromCvMat
VnlVectorFromCvMat(const cv::Mat *_CvMat, vnl_vector< T > *_VnlVector)
Definition: mitkVnlVectorFromCvMat.h:31
mitk::VnlVectorFromCvMat::Update
void Update() override
Definition: mitkVnlVectorFromCvMat.h:42