IDS peak ICV v1.0.0
Loading...
Searching...
No Matches
peak_icv_rotation.hpp
Go to the documentation of this file.
1
11#pragma once
12
15
16#include <string>
17
18namespace peak
19{
20namespace pipeline
21{
22
30enum class Rotation
31{
36 None = 0,
37
43
48 Degree180 = 180,
49
55};
56
65PEAK_COMMON_NO_DISCARD inline std::string ToString(Rotation rotation)
66{
67 switch (rotation)
68 {
69 case Rotation::None:
70 return "None";
72 return "Degree90Counterclockwise";
74 return "Degree180";
76 return "Degree90Clockwise";
77 }
78
79 const auto rotationStr = std::to_string(static_cast<int>(rotation));
80 throw peak::icv::NotSupportedException("The given rotation " + rotationStr + " is unknown!");
81}
82
91inline std::ostream& operator<<(std::ostream& os, Rotation rotation)
92{
93 return os << ToString(rotation);
94}
95
96namespace detail
97{
106PEAK_COMMON_NO_DISCARD inline Rotation ToRotation(const std::string& rotation)
107{
108 if (rotation == "None")
109 {
110 return Rotation::None;
111 }
112 if (rotation == "Degree90Counterclockwise")
113 {
115 }
116 if (rotation == "Degree180")
117 {
118 return Rotation::Degree180;
119 }
120 if (rotation == "Degree90Clockwise")
121 {
123 }
124 throw peak::icv::NotSupportedException("The given rotation " + rotation + " is unknown! ");
125}
126} // namespace detail
127
128} // namespace pipeline
129} // namespace peak
Thrown when a requested operation is not implemented or supported.
#define PEAK_COMMON_NO_DISCARD
Compatability macro for the nodiscard attribute.
Rotation
Angle parameter for the rotation algorithm.
@ None
No rotation applied to the image.
@ Degree90Counterclockwise
Rotate the image 90 degrees counterclockwise.
@ Degree180
Rotate the image 180 degrees (upside down).
@ Degree90Clockwise
Rotate the image 90 degrees clockwise.
Rotation ToRotation(const std::string &rotation)
Converts a string representation to a Rotation enum value.
std::string ToString(BinningMode mode)
Converts a BinningMode enum value to its string representation.
std::ostream & operator<<(std::ostream &os, BinningMode mode)
Stream output operator for BinningMode enum.