MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkCvMatCompare.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 mitkCvMatCompare_h
13#define mitkCvMatCompare_h
14
15#include <mitkEpsilon.h>
16#include <mitkObservable.h>
17#include <mitkAlgorithm.h>
18#include <mitkEndoDebug.h>
19
20namespace mitk
21{
26 virtual public Algorithm
27 {
28 public:
33 const Epsilon* _Epsilon,
34 bool* _Equals):
35 m_CvMat1(nullptr),
36 m_CvMat2(nullptr),
37 m_Epsilon(_Epsilon),
38 m_Equals(_Equals)
39 {
40 }
45 const cv::Mat* _CvMat1,
46 const cv::Mat* _CvMat2,
47 const Epsilon* _Epsilon,
48 bool* _Equals):
49 m_CvMat1(_CvMat1),
50 m_CvMat2(_CvMat2),
51 m_Epsilon(_Epsilon),
52 m_Equals(_Equals)
53 {
54 }
55
56 void SetMatrices( const cv::Mat* _CvMat1, const cv::Mat* _CvMat2 )
57 {
58 m_CvMat1 = _CvMat1;
59 m_CvMat2 = _CvMat2;
60 }
61
62 void SetMatrix1( const cv::Mat* _CvMat1 )
63 {
64 m_CvMat1 = _CvMat1;
65 }
66 void SetMatrix2( const cv::Mat* _CvMat2 )
67 {
68 m_CvMat2 = _CvMat2;
69 }
70
74 void Update() override
75 {
76 assert( m_CvMat1 && m_CvMat2 );
77 cv::Mat dst;
78 cv::absdiff( (*m_CvMat1), (*m_CvMat2), dst);
79 double max = 0;
80 cv::minMaxLoc( dst, nullptr, &max );
81
82 endodebugvar( max )
83
84 (*m_Equals) = max <= *m_Epsilon;
85 }
86 private:
90 const cv::Mat* m_CvMat1;
94 const cv::Mat* m_CvMat2;
98 const Epsilon* m_Epsilon;
102 bool* m_Equals;
103 };
104} // namespace mitk
105
106#endif
CvMatCompare(const Epsilon *_Epsilon, bool *_Equals)
CvMatCompare(const cv::Mat *_CvMat1, const cv::Mat *_CvMat2, const Epsilon *_Epsilon, bool *_Equals)
void Update() override
void SetMatrix2(const cv::Mat *_CvMat2)
void SetMatrices(const cv::Mat *_CvMat1, const cv::Mat *_CvMat2)
void SetMatrix1(const cv::Mat *_CvMat1)
#define endodebugvar(var)
IGT Exceptions.
double Epsilon
Definition mitkEpsilon.h:20