MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkVnlVectorFromCvMat.h
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12#ifndef mitkVnlVectorFromCvMat_h
13#define mitkVnlVectorFromCvMat_h
14
16#include <vnl/vnl_vector.h>
17
18namespace 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
VnlVectorFromCvMat(const cv::Mat *_CvMat, vnl_vector< T > *_VnlVector)
IGT Exceptions.