SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
bilateralfilter.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 BilateralFilter : public TransformationEx
12 {
13 public:
14 BilateralFilter(const BilateralFilter& other)
15 : TransformationEx(other),
16 m_diameter(other.m_diameter),
17 m_sigmaColor(other.m_sigmaColor),
18 m_sigmaSpace(other.m_sigmaSpace) {
19 }
20
21 BilateralFilter(BilateralFilter&& other) noexcept
22 : TransformationEx(std::move(other)),
23 m_diameter(other.m_diameter),
24 m_sigmaColor(other.m_sigmaColor),
25 m_sigmaSpace(other.m_sigmaSpace) {
26 }
27
28 BilateralFilter& operator=(const BilateralFilter& other) {
29 if (this == &other)
30 return *this;
31 TransformationEx::operator =(other);
32 m_diameter = other.m_diameter;
33 m_sigmaColor = other.m_sigmaColor;
34 m_sigmaSpace = other.m_sigmaSpace;
35 return *this;
36 }
37
38 BilateralFilter& operator=(BilateralFilter&& other) noexcept {
39 if (this == &other)
40 return *this;
41 TransformationEx::operator =(std::move(other));
42 m_diameter = other.m_diameter;
43 m_sigmaColor = other.m_sigmaColor;
44 m_sigmaSpace = other.m_sigmaSpace;
45 return *this;
46 }
47
48 BilateralFilter()
49 {
50 m_type = TransformationType::BilateralFilter;
51 }
52
53 int getDiameter() const
54 {
55 return m_diameter;
56 }
57
58 void setDiameter(int diameter)
59 {
60 m_diameter = diameter;
61 }
62
63 double getSigmaColor() const
64 {
65 return m_sigmaColor;
66 }
67
68 void setSigmaColor(double sigmaColor)
69 {
70 m_sigmaColor = sigmaColor;
71 }
72
73 double getSigmaSpace() const
74 {
75 return m_sigmaSpace;
76 }
77
78 void setSigmaSpace(double sigmaSpace)
79 {
80 m_sigmaSpace = sigmaSpace;
81 }
82
83 void applyTransformation(const cv::Mat& block, cv::OutputArray transformedBlock) const override;
84 std::vector<DataType> computeChannelDataTypes(const std::vector<DataType>& channels) const override;
85 int getInflationValue() const override;
86
87 private:
88 int m_diameter = 5;
89 double m_sigmaColor = 1.;
90 double m_sigmaSpace = 1.;
91 };
92}
Definition: exceptions.hpp:15