comparison Core/Images/ImageProcessing.h @ 3992:f9863630ec7f

working on the shared library for Orthanc framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Jun 2020 16:07:01 +0200
parents a9ce35d67c3c
children 73c22208272f
comparison
equal deleted inserted replaced
3991:5d2348b39392 3992:f9863630ec7f
31 **/ 31 **/
32 32
33 33
34 #pragma once 34 #pragma once
35 35
36 #include "../OrthancFramework.h"
37
36 #include "ImageAccessor.h" 38 #include "ImageAccessor.h"
37 #include <vector> 39 #include <vector>
38 40
39 #include <stdint.h> 41 #include <stdint.h>
40 #include <algorithm> 42 #include <algorithm>
43 #include <boost/noncopyable.hpp>
41 44
42 namespace Orthanc 45 namespace Orthanc
43 { 46 {
44 namespace ImageProcessing 47 class ORTHANC_PUBLIC ImageProcessing : public boost::noncopyable
45 { 48 {
49 public:
46 class ImagePoint 50 class ImagePoint
47 { 51 {
48 int32_t x_; 52 int32_t x_;
49 int32_t y_; 53 int32_t y_;
50 54
51 public: 55 public:
52 ImagePoint(int32_t x, int32_t y) 56 ImagePoint(int32_t x, int32_t y)
53 : x_(x), 57 : x_(x),
54 y_(y) 58 y_(y)
55 { 59 {
56 } 60 }
74 double GetDistanceTo(const ImagePoint& other) const; 78 double GetDistanceTo(const ImagePoint& other) const;
75 79
76 double GetDistanceToLine(double a, double b, double c) const; // where ax + by + c = 0 is the equation of the line 80 double GetDistanceToLine(double a, double b, double c) const; // where ax + by + c = 0 is the equation of the line
77 }; 81 };
78 82
79 void Copy(ImageAccessor& target, 83 static void Copy(ImageAccessor& target,
80 const ImageAccessor& source); 84 const ImageAccessor& source);
81 85
82 void Convert(ImageAccessor& target, 86 static void Convert(ImageAccessor& target,
83 const ImageAccessor& source); 87 const ImageAccessor& source);
84 88
85 void ApplyWindowing_Deprecated(ImageAccessor& target, 89 static void ApplyWindowing_Deprecated(ImageAccessor& target,
86 const ImageAccessor& source, 90 const ImageAccessor& source,
87 float windowCenter, 91 float windowCenter,
88 float windowWidth, 92 float windowWidth,
89 float rescaleSlope, 93 float rescaleSlope,
90 float rescaleIntercept, 94 float rescaleIntercept,
91 bool invert); 95 bool invert);
92 96
93 void Set(ImageAccessor& image, 97 static void Set(ImageAccessor& image,
94 int64_t value); 98 int64_t value);
95 99
96 void Set(ImageAccessor& image, 100 static void Set(ImageAccessor& image,
97 uint8_t red, 101 uint8_t red,
98 uint8_t green, 102 uint8_t green,
99 uint8_t blue, 103 uint8_t blue,
100 uint8_t alpha); 104 uint8_t alpha);
101 105
102 void Set(ImageAccessor& image, 106 static void Set(ImageAccessor& image,
103 uint8_t red, 107 uint8_t red,
104 uint8_t green, 108 uint8_t green,
105 uint8_t blue, 109 uint8_t blue,
106 ImageAccessor& alpha); 110 ImageAccessor& alpha);
107 111
108 void ShiftRight(ImageAccessor& target, 112 static void ShiftRight(ImageAccessor& target,
109 unsigned int shift); 113 unsigned int shift);
110 114
111 void ShiftLeft(ImageAccessor& target, 115 static void ShiftLeft(ImageAccessor& target,
112 unsigned int shift); 116 unsigned int shift);
113 117
114 void GetMinMaxIntegerValue(int64_t& minValue, 118 static void GetMinMaxIntegerValue(int64_t& minValue,
115 int64_t& maxValue, 119 int64_t& maxValue,
116 const ImageAccessor& image); 120 const ImageAccessor& image);
117 121
118 void GetMinMaxFloatValue(float& minValue, 122 static void GetMinMaxFloatValue(float& minValue,
119 float& maxValue, 123 float& maxValue,
120 const ImageAccessor& image); 124 const ImageAccessor& image);
121 125
122 void AddConstant(ImageAccessor& image, 126 static void AddConstant(ImageAccessor& image,
123 int64_t value); 127 int64_t value);
124 128
125 // "useRound" is expensive 129 // "useRound" is expensive
126 void MultiplyConstant(ImageAccessor& image, 130 static void MultiplyConstant(ImageAccessor& image,
127 float factor, 131 float factor,
128 bool useRound); 132 bool useRound);
129 133
130 // Computes "(x + offset) * scaling" inplace. "useRound" is expensive. 134 // Computes "(x + offset) * scaling" inplace. "useRound" is expensive.
131 void ShiftScale(ImageAccessor& image, 135 static void ShiftScale(ImageAccessor& image,
132 float offset, 136 float offset,
133 float scaling, 137 float scaling,
134 bool useRound); 138 bool useRound);
135 139
136 void ShiftScale(ImageAccessor& target, 140 static void ShiftScale(ImageAccessor& target,
137 const ImageAccessor& source, 141 const ImageAccessor& source,
138 float offset, 142 float offset,
139 float scaling, 143 float scaling,
140 bool useRound); 144 bool useRound);
141 145
142 void Invert(ImageAccessor& image); 146 static void Invert(ImageAccessor& image);
143 147
144 void Invert(ImageAccessor& image, int64_t maxValue); 148 static void Invert(ImageAccessor& image, int64_t maxValue);
145 149
146 void DrawLineSegment(ImageAccessor& image, 150 static void DrawLineSegment(ImageAccessor& image,
147 int x0, 151 int x0,
148 int y0, 152 int y0,
149 int x1, 153 int x1,
150 int y1, 154 int y1,
151 int64_t value); 155 int64_t value);
152 156
153 void DrawLineSegment(ImageAccessor& image, 157 static void DrawLineSegment(ImageAccessor& image,
154 int x0, 158 int x0,
155 int y0, 159 int y0,
156 int x1, 160 int x1,
157 int y1, 161 int y1,
158 uint8_t red, 162 uint8_t red,
159 uint8_t green, 163 uint8_t green,
160 uint8_t blue, 164 uint8_t blue,
161 uint8_t alpha); 165 uint8_t alpha);
162 166
163 void FillPolygon(ImageAccessor& image, 167 static void FillPolygon(ImageAccessor& image,
164 const std::vector<ImagePoint>& points, 168 const std::vector<ImagePoint>& points,
165 int64_t value); 169 int64_t value);
166 170
167 void Resize(ImageAccessor& target, 171 static void Resize(ImageAccessor& target,
168 const ImageAccessor& source); 172 const ImageAccessor& source);
169 173
170 ImageAccessor* Halve(const ImageAccessor& source, 174 static ImageAccessor* Halve(const ImageAccessor& source,
171 bool forceMinimalPitch); 175 bool forceMinimalPitch);
172 176
173 void FlipX(ImageAccessor& image); 177 static void FlipX(ImageAccessor& image);
174 178
175 void FlipY(ImageAccessor& image); 179 static void FlipY(ImageAccessor& image);
176 180
177 void SeparableConvolution(ImageAccessor& image /* inplace */, 181 static void SeparableConvolution(ImageAccessor& image /* inplace */,
178 const std::vector<float>& horizontal, 182 const std::vector<float>& horizontal,
179 size_t horizontalAnchor, 183 size_t horizontalAnchor,
180 const std::vector<float>& vertical, 184 const std::vector<float>& vertical,
181 size_t verticalAnchor); 185 size_t verticalAnchor);
182 186
183 void SmoothGaussian5x5(ImageAccessor& image); 187 static void SmoothGaussian5x5(ImageAccessor& image);
184 188
185 void FitSize(ImageAccessor& target, 189 static void FitSize(ImageAccessor& target,
186 const ImageAccessor& source); 190 const ImageAccessor& source);
187 191
188 ImageAccessor* FitSize(const ImageAccessor& source, 192 static ImageAccessor* FitSize(const ImageAccessor& source,
189 unsigned int width, 193 unsigned int width,
190 unsigned int height); 194 unsigned int height);
191 } 195 };
192 } 196 }
197