SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
cannyfilter.hpp
1// This file is part of slideio project.
2// It is subject to the license terms in the LICENSE file found in the top-level directory
3// of this distribution and at http://slideio.com/license.html.
4#pragma once
5#include "slideio/transformer/transformationex.hpp"
6#include "slideio/transformer/transformationtype.hpp"
7
8namespace slideio
9{
10
11 class SLIDEIO_TRANSFORMER_EXPORTS CannyFilter : public TransformationEx
12 {
13 public:
14 CannyFilter(const CannyFilter& other)
15 : TransformationEx(other),
16 m_threshold1(other.m_threshold1),
17 m_threshold2(other.m_threshold2),
18 m_apertureSize(other.m_apertureSize),
19 m_L2gradient(other.m_L2gradient) {
20 }
21
22 CannyFilter(CannyFilter&& other) noexcept
23 : TransformationEx(std::move(other)),
24 m_threshold1(other.m_threshold1),
25 m_threshold2(other.m_threshold2),
26 m_apertureSize(other.m_apertureSize),
27 m_L2gradient(other.m_L2gradient) {
28 }
29
30 CannyFilter& operator=(const CannyFilter& other) {
31 if (this == &other)
32 return *this;
33 TransformationEx::operator =(other);
34 m_threshold1 = other.m_threshold1;
35 m_threshold2 = other.m_threshold2;
36 m_apertureSize = other.m_apertureSize;
37 m_L2gradient = other.m_L2gradient;
38 return *this;
39 }
40
41 CannyFilter& operator=(CannyFilter&& other) noexcept {
42 if (this == &other)
43 return *this;
44 TransformationEx::operator =(std::move(other));
45 m_threshold1 = other.m_threshold1;
46 m_threshold2 = other.m_threshold2;
47 m_apertureSize = other.m_apertureSize;
48 m_L2gradient = other.m_L2gradient;
49 return *this;
50 }
51
52 CannyFilter()
53 {
54 m_type = TransformationType::CannyFilter;
55 }
56
57 double getThreshold1() const
58 {
59 return m_threshold1;
60 }
61
62 void setThreshold1(double threshold1)
63 {
64 m_threshold1 = threshold1;
65 }
66
67 double getThreshold2() const
68 {
69 return m_threshold2;
70 }
71
72 void setThreshold2(double threshold2)
73 {
74 m_threshold2 = threshold2;
75 }
76
77 int getApertureSize() const
78 {
79 return m_apertureSize;
80 }
81
82 void setApertureSize(int apertureSize)
83 {
84 m_apertureSize = apertureSize;
85 }
86
87 bool getL2Gradient() const
88 {
89 return m_L2gradient;
90 }
91
92 void setL2Gradient(bool L2gradient)
93 {
94 m_L2gradient = L2gradient;
95 }
96
97 void applyTransformation(const cv::Mat& block, cv::OutputArray transformedBlock) const override;
98 std::vector<DataType> computeChannelDataTypes(const std::vector<DataType>& channels) const override;
99 int getInflationValue() const override;
100
101 private:
102 double m_threshold1 = 100.;
103 double m_threshold2 = 200.;
104 int m_apertureSize = 3;
105 bool m_L2gradient = false;
106 };
107};
Definition: exceptions.hpp:15