SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
colortransformation.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/transformer_def.hpp"
6#include "slideio/transformer/transformationex.hpp"
7#include "slideio/transformer/colorspace.hpp"
8#include "slideio/transformer/transformationtype.hpp"
9
10namespace slideio
11{
12 class SLIDEIO_TRANSFORMER_EXPORTS ColorTransformation : public slideio::TransformationEx
13 {
14 public:
15 ColorTransformation() {
16 m_type = TransformationType::ColorTransformation;
17 m_colorSpace = ColorSpace::RGB;
18 }
19
20 ColorTransformation(const ColorTransformation& other)
21 : slideio::TransformationEx(other),
22 m_colorSpace(other.m_colorSpace) {
23 }
24
25 ColorTransformation(ColorTransformation&& other) noexcept
26 : slideio::TransformationEx(std::move(other)),
27 m_colorSpace(other.m_colorSpace) {
28 }
29
30 ColorTransformation& operator=(const ColorTransformation& other) {
31 if (this == &other)
32 return *this;
33 slideio::TransformationEx::operator =(other);
34 m_colorSpace = other.m_colorSpace;
35 return *this;
36 }
37
38 ColorTransformation& operator=(ColorTransformation&& other) noexcept {
39 if (this == &other)
40 return *this;
41 slideio::TransformationEx::operator =(std::move(other));
42 m_colorSpace = other.m_colorSpace;
43 return *this;
44 }
45
46 ColorTransformation(ColorSpace colorSpace) {
47 m_type = TransformationType::ColorTransformation;
48 m_colorSpace = colorSpace;
49 }
50 ColorSpace getColorSpace() const {
51 return m_colorSpace;
52 }
53 void setColorSpace(ColorSpace colorSpace) {
54 m_colorSpace = colorSpace;
55 }
56
57 void applyTransformation(const cv::Mat& block, cv::OutputArray transformedBlock) const override;
58 std::vector<DataType> computeChannelDataTypes(const std::vector<DataType>& channels) const override;
59
60 private:
61 ColorSpace m_colorSpace;
62 };
63}
Definition: exceptions.hpp:15