Loading [MathJax]/extensions/tex2jax.js
SimpleITK  2.5.0.dev
sitkImageOperators.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef sitkImageOperators_h
19#define sitkImageOperators_h
20
21#include "sitkAddImageFilter.h"
28#include "sitkAndImageFilter.h"
29#include "sitkOrImageFilter.h"
30#include "sitkXorImageFilter.h"
31
32namespace itk::simple
33{
34
44inline Image
45operator+(const Image & img1, const Image & img2)
46{
47 return Add(img1, img2);
48}
49inline Image
50operator+(Image && img1, const Image & img2)
51{
52 return Add(std::move(img1), img2);
53}
54inline Image
55operator+(const Image & img, double s)
56{
57 return Add(img, s);
58}
59inline Image
60operator+(Image && img, double s)
61{
62 return Add(std::move(img), s);
63}
64inline Image
65operator+(double s, const Image & img)
66{
67 return Add(s, img);
68}
69inline Image
70operator-(const Image & img1, const Image & img2)
71{
72 return Subtract(img1, img2);
73}
74inline Image
75operator-(Image && img1, const Image & img2)
76{
77 return Subtract(std::move(img1), img2);
78}
79inline Image
80operator-(const Image & img, double s)
81{
82 return Subtract(img, s);
83}
84inline Image
85operator-(Image && img, double s)
86{
87 return Subtract(std::move(img), s);
88}
89inline Image
90operator-(double s, const Image & img)
91{
92 return Subtract(s, img);
93}
94inline Image
95operator*(const Image & img1, const Image & img2)
96{
97 return Multiply(img1, img2);
98}
99inline Image
100operator*(Image && img1, const Image & img2)
101{
102 return Multiply(std::move(img1), img2);
103}
104inline Image
105operator*(const Image & img, double s)
106{
107 return Multiply(img, s);
108}
109inline Image
110operator*(Image && img, double s)
111{
112 return Multiply(std::move(img), s);
113}
114inline Image
115operator*(double s, const Image & img)
116{
117 return Multiply(s, img);
118}
119inline Image
120operator/(const Image & img1, const Image & img2)
121{
122 return Divide(img1, img2);
123}
124inline Image
125operator/(Image && img1, const Image & img2)
126{
127 return Divide(std::move(img1), img2);
128}
129inline Image
130operator/(const Image & img, double s)
131{
132 return Divide(img, s);
133}
134inline Image
135operator/(Image && img, double s)
136{
137 return Divide(std::move(img), s);
138}
139inline Image
140operator/(double s, const Image & img)
141{
142 return Divide(s, img);
143}
144inline Image
145operator%(const Image & img1, const Image & img2)
146{
147 return Modulus(img1, img2);
148}
149inline Image
150operator%(Image && img1, const Image & img2)
151{
152 return Modulus(std::move(img1), img2);
153}
154inline Image
155operator%(const Image & img, uint32_t s)
156{
157 return Modulus(img, s);
158}
159inline Image
160operator%(Image && img, uint32_t s)
161{
162 return Modulus(std::move(img), s);
163}
164inline Image
165operator%(uint32_t s, const Image & img)
166{
167 return Modulus(s, img);
168}
169
170inline Image
171operator-(const Image & img)
172{
173 return UnaryMinus(img);
174}
175inline Image
177{
178 return UnaryMinus(std::move(img));
179}
180
181
182inline Image
183operator~(const Image & img)
184{
185 return BitwiseNot(img);
186}
187inline Image
189{
190 return BitwiseNot(std::move(img));
191}
192
193inline Image
194operator&(const Image & img1, const Image & img2)
195{
196 return And(img1, img2);
197}
198inline Image
199operator&(Image && img1, const Image & img2)
200{
201 return And(std::move(img1), img2);
202}
203inline Image
204operator&(const Image & img, int s)
205{
206 return And(img, s);
207}
208inline Image
209operator&(Image && img, int s)
210{
211 return And(std::move(img), s);
212}
213inline Image
214operator&(int s, const Image & img)
215{
216 return And(s, img);
217}
218
219inline Image
220operator|(const Image & img1, const Image & img2)
221{
222 return Or(img1, img2);
223}
224inline Image
225operator|(Image && img1, const Image & img2)
226{
227 return Or(std::move(img1), img2);
228}
229inline Image
230operator|(const Image & img, int s)
231{
232 return Or(img, s);
233}
234inline Image
235operator|(Image && img, int s)
236{
237 return Or(std::move(img), s);
238}
239inline Image
240operator|(int s, const Image & img)
241{
242 return Or(s, img);
243}
244
245inline Image
246operator^(const Image & img1, const Image & img2)
247{
248 return Xor(img1, img2);
249}
250inline Image
251operator^(Image && img1, const Image & img2)
252{
253 return Xor(std::move(img1), img2);
254}
255inline Image
256operator^(const Image & img, int s)
257{
258 return Xor(img, s);
259}
260inline Image
261operator^(Image && img, int s)
262{
263 return Xor(std::move(img), s);
264}
265inline Image
266operator^(int s, const Image & img)
267{
268 return Xor(s, img);
269}
270
271
272inline Image &
273operator+=(Image & img1, const Image & img2)
274{
275 Add(img1.ProxyForInPlaceOperation(), img2);
276 return img1;
277}
278inline Image &
279operator+=(Image & img1, double s)
280{
281 Add(img1.ProxyForInPlaceOperation(), s);
282 return img1;
283}
284inline Image &
285operator-=(Image & img1, const Image & img2)
286{
288 return img1;
289}
290inline Image &
291operator-=(Image & img1, double s)
292{
294 return img1;
295}
296inline Image &
297operator*=(Image & img1, const Image & img2)
298{
300 return img1;
301}
302inline Image &
303operator*=(Image & img1, double s)
304{
306 return img1;
307}
308inline Image &
309operator/=(Image & img1, const Image & img2)
310{
311 Divide(img1.ProxyForInPlaceOperation(), img2);
312 return img1;
313}
314inline Image &
315operator/=(Image & img1, double s)
316{
318 return img1;
319}
320inline Image &
321operator%=(Image & img1, const Image & img2)
322{
323 Modulus(img1.ProxyForInPlaceOperation(), img2);
324 return img1;
325}
326inline Image &
327operator%=(Image & img1, uint32_t s)
328{
330 return img1;
331}
332inline Image &
333operator&=(Image & img1, const Image & img2)
334{
335 And(img1.ProxyForInPlaceOperation(), img2);
336 return img1;
337}
338inline Image &
339operator&=(Image & img1, int s)
340{
341 And(img1.ProxyForInPlaceOperation(), s);
342 return img1;
343}
344inline Image &
345operator|=(Image & img1, const Image & img2)
346{
347 Or(img1.ProxyForInPlaceOperation(), img2);
348 return img1;
349}
350inline Image &
351operator|=(Image & img1, int s)
352{
353 Or(img1.ProxyForInPlaceOperation(), s);
354 return img1;
355}
356inline Image &
357operator^=(Image & img1, const Image & img2)
358{
359 Xor(img1.ProxyForInPlaceOperation(), img2);
360 return img1;
361}
362inline Image &
363operator^=(Image & img1, int s)
364{
365 Xor(img1.ProxyForInPlaceOperation(), s);
366 return img1;
367}
368
369} // namespace itk::simple
370
371#endif // sitkImageOperators_h
The Image class for SimpleITK.
Definition sitkImage.h:77
Image ProxyForInPlaceOperation()
Advanced method not commonly needed.
Image & operator/=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image & operator%=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image UnaryMinus(Image &&image1)
Implements pixel-wise generic operation on one image.
Image And(Image &&image1, const Image &image2)
Implements the AND bitwise operator pixel-wise between two images.
Image operator/(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image Or(Image &&image1, const Image &image2)
Implements the OR bitwise operator pixel-wise between two images.
Image & operator-=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image operator-(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image operator*(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image operator|(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image & operator*=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image operator~(const Image &img)
Performs the operator on a per pixel basis.
Image operator^(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image operator+(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image & operator^=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image BitwiseNot(Image &&image1)
Implements pixel-wise generic operation on one image.
Image & operator|=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image & operator+=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image Multiply(Image &&image1, const Image &image2)
Pixel-wise multiplication of two images.
Image Subtract(Image &&image1, const Image &image2)
Pixel-wise subtraction of two images.
Image Modulus(Image &&image1, const Image &image2)
Computes the modulus (x % dividend) pixel-wise.
Image Add(Image &&image1, const Image &image2)
Pixel-wise addition of two images.
Image Xor(Image &&image1, const Image &image2)
Computes the XOR bitwise operator pixel-wise between two images.
Image & operator&=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image Divide(Image &&image1, const Image &image2)
Pixel-wise division of two images.
Image operator&(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image operator%(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.