SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
scharrfilter.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#include "slideio/base/slideio_enums.hpp"
8
9namespace slideio
10{
11 class SLIDEIO_TRANSFORMER_EXPORTS ScharrFilter : public TransformationEx
12 {
13 public:
14 ScharrFilter() {
15 m_type = TransformationType::ScharrFilter;
16 }
17
18 ScharrFilter(const ScharrFilter& other)
19 : TransformationEx(other),
20 m_depth(other.m_depth),
21 m_dx(other.m_dx),
22 m_dy(other.m_dy),
23 m_scale(other.m_scale),
24 m_delta(other.m_delta) {
25 }
26
27 ScharrFilter(ScharrFilter&& other) noexcept
28 : TransformationEx(std::move(other)),
29 m_depth(other.m_depth),
30 m_dx(other.m_dx),
31 m_dy(other.m_dy),
32 m_scale(other.m_scale),
33 m_delta(other.m_delta) {
34 }
35
36 ScharrFilter& operator=(const ScharrFilter& other) {
37 if (this == &other)
38 return *this;
39 TransformationEx::operator =(other);
40 m_depth = other.m_depth;
41 m_dx = other.m_dx;
42 m_dy = other.m_dy;
43 m_scale = other.m_scale;
44 m_delta = other.m_delta;
45 return *this;
46 }
47
48 ScharrFilter& operator=(ScharrFilter&& other) noexcept {
49 if (this == &other)
50 return *this;
51 TransformationEx::operator =(std::move(other));
52 m_depth = other.m_depth;
53 m_dx = other.m_dx;
54 m_dy = other.m_dy;
55 m_scale = other.m_scale;
56 m_delta = other.m_delta;
57 return *this;
58 }
59
60 DataType getDepth() const {
61 return m_depth;
62 }
63
64 void setDepth(const DataType& depth) {
65 m_depth = depth;
66 }
67
68 int getDx() const {
69 return m_dx;
70 }
71
72 void setDx(int dx) {
73 m_dx = dx;
74 }
75
76 int getDy() const {
77 return m_dy;
78 }
79
80 void setDy(int dy) {
81 m_dy = dy;
82 }
83
84 double getScale() const {
85 return m_scale;
86 }
87
88 void setScale(double scale) {
89 m_scale = scale;
90 }
91
92 double getDelta() const {
93 return m_delta;
94 }
95
96 void setDelta(double delta) {
97 m_delta = delta;
98 }
99
100 void applyTransformation(const cv::Mat& block, cv::OutputArray transformedBlock) const override;
101 int getInflationValue() const override;
102 std::vector<DataType> computeChannelDataTypes(const std::vector<DataType>& channels) const override;
103
104 private:
105 DataType m_depth = DataType::DT_Float32;
106 int m_dx = 1;
107 int m_dy = 1;
108 double m_scale = 1.;
109 double m_delta = 0.;
110 };
111}
Definition: exceptions.hpp:15