SimpleITK  2.0.0
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"
24 #include "sitkDivideImageFilter.h"
25 #include "sitkModulusImageFilter.h"
28 #include "sitkAndImageFilter.h"
29 #include "sitkOrImageFilter.h"
30 #include "sitkXorImageFilter.h"
31 
32 namespace itk {
33 namespace simple {
34 
44 inline Image operator+( const Image &img1, const Image &img2 ) { return Add(img1, img2 ); }
45 inline Image operator+( Image &&img1, const Image &img2 ) { return Add(std::move(img1), img2 ); }
46 inline Image operator+( const Image &img, double s ) { return Add(img, s ); }
47 inline Image operator+( Image &&img, double s ) { return Add(std::move(img), s ); }
48 inline Image operator+( double s, const Image &img ) { return Add(s, img ); }
49 inline Image operator-( const Image &img1, const Image &img2 ) { return Subtract(img1, img2 ); }
50 inline Image operator-( Image &&img1, const Image &img2 ) { return Subtract(std::move(img1), img2 ); }
51 inline Image operator-( const Image &img, double s ) { return Subtract(img, s ); }
52 inline Image operator-( Image &&img, double s ) { return Subtract(std::move(img), s ); }
53 inline Image operator-( double s, const Image &img ) { return Subtract(s, img ); }
54 inline Image operator*( const Image &img1, const Image &img2 ) { return Multiply(img1, img2 ); }
55 inline Image operator*( Image &&img1, const Image &img2 ) { return Multiply(std::move(img1), img2 ); }
56 inline Image operator*( const Image &img, double s ) { return Multiply(img, s ); }
57 inline Image operator*( Image &&img, double s ) { return Multiply(std::move(img), s ); }
58 inline Image operator*( double s, const Image &img ) { return Multiply(s, img ); }
59 inline Image operator/( const Image &img1, const Image &img2 ) { return Divide(img1, img2 ); }
60 inline Image operator/( Image &&img1, const Image &img2 ) { return Divide(std::move(img1), img2 ); }
61 inline Image operator/( const Image &img, double s ) { return Divide(img, s ); }
62 inline Image operator/( Image &&img, double s ) { return Divide(std::move(img), s ); }
63 inline Image operator/( double s, const Image &img ) { return Divide(s, img ); }
64 inline Image operator%( const Image &img1, const Image &img2 ) { return Modulus(img1, img2 ); }
65 inline Image operator%( Image &&img1, const Image &img2 ) { return Modulus(std::move(img1), img2 ); }
66 inline Image operator%( const Image &img, uint32_t s ) { return Modulus(img, s ); }
67 inline Image operator%( Image &&img, uint32_t s ) { return Modulus(std::move(img), s ); }
68 inline Image operator%( uint32_t s, const Image &img ) { return Modulus(s, img ); }
69 
70 inline Image operator-( const Image &img ) { return UnaryMinus( img ); }
71 inline Image operator-( Image &&img ) { return UnaryMinus( std::move(img) ); }
72 
73 
74 inline Image operator~( const Image &img ) { return BitwiseNot( img ); }
75 inline Image operator~( Image &&img ) { return BitwiseNot( std::move(img) ); }
76 
77 inline Image operator&( const Image &img1, const Image &img2 ) { return And(img1, img2 ); }
78 inline Image operator&( Image &&img1, const Image &img2 ) { return And(std::move(img1), img2 ); }
79 inline Image operator&( const Image &img, int s ) { return And(img, s ); }
80 inline Image operator&( Image &&img, int s ) { return And(std::move(img), s ); }
81 inline Image operator&( int s, const Image &img ) { return And(s, img ); }
82 
83 inline Image operator|( const Image &img1, const Image &img2 ) { return Or(img1, img2 ); }
84 inline Image operator|( Image &&img1, const Image &img2 ) { return Or(std::move(img1), img2 ); }
85 inline Image operator|( const Image &img, int s ) { return Or(img, s ); }
86 inline Image operator|( Image &&img, int s ) { return Or(std::move(img), s ); }
87 inline Image operator|( int s, const Image &img ) { return Or(s, img ); }
88 
89 inline Image operator^( const Image &img1, const Image &img2 ) { return Xor(img1, img2 ); }
90 inline Image operator^( Image &&img1, const Image &img2 ) { return Xor(std::move(img1), img2 ); }
91 inline Image operator^( const Image &img, int s ) { return Xor(img, s ); }
92 inline Image operator^( Image &&img, int s ) { return Xor(std::move(img), s ); }
93 inline Image operator^( int s, const Image &img ) { return Xor(s, img ); }
94 
95 
96 inline Image &operator+=( Image &img1, const Image &img2 ) { return img1 = Add(std::move(img1), img2 ); }
97 inline Image &operator+=( Image &img1, double s ) { return img1 = Add(std::move(img1), s ); }
98 inline Image &operator-=( Image &img1, const Image &img2 ) { return img1 = Subtract(std::move(img1), img2 ); }
99 inline Image &operator-=( Image &img1, double s ) { return img1 = Subtract(std::move(img1), s ); }
100 inline Image &operator*=( Image &img1, const Image &img2 ) { return img1 = Multiply(std::move(img1), img2 ); }
101 inline Image &operator*=( Image &img1, double s ) { return img1 = Multiply(std::move(img1), s ); }
102 inline Image &operator/=( Image &img1, const Image &img2 ) { return img1 = Divide(std::move(img1), img2 ); }
103 inline Image &operator/=( Image &img1, double s ) { return img1 = Divide(std::move(img1), s ); }
104 inline Image &operator%=( Image &img1, const Image &img2 ) { return img1 = Modulus(std::move(img1), img2 ); }
105 inline Image &operator%=( Image &img1, uint32_t s ) { return img1 = Modulus(std::move(img1), s ); }
106 inline Image &operator&=( Image &img1, const Image &img2 ) { return img1 = And(std::move(img1), img2 ); }
107 inline Image &operator&=( Image &img1, int s ) { return img1 = And(std::move(img1), s ); }
108 inline Image &operator|=( Image &img1, const Image &img2 ) { return img1 = Or(std::move(img1), img2 ); }
109 inline Image &operator|=( Image &img1, int s ) { return img1 = Or(std::move(img1), s ); }
110 inline Image &operator^=( Image &img1, const Image &img2 ) { return img1 = Xor(std::move(img1), img2 ); }
111 inline Image &operator^=( Image &img1, int s ) { return img1 = Xor(std::move(img1), s ); }
113 }
114 }
115 
116 #endif // sitkImageOperators_h
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:75
itk::simple::operator|=
Image & operator|=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:108
itk::simple::Modulus
Image Modulus(Image &&image1, const Image &image2)
Computes the modulus (x % dividend) pixel-wise.
itk::simple::operator%
Image operator%(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:64
sitkBitwiseNotImageFilter.h
sitkAddImageFilter.h
itk::simple::Subtract
Image Subtract(Image &&image1, const Image &image2)
Pixel-wise subtraction of two images.
itk::simple::operator|
Image operator|(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:83
itk::simple::operator^=
Image & operator^=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:110
itk::simple::Or
Image Or(Image &&image1, const Image &image2)
Implements the OR bitwise operator pixel-wise between two images.
itk::simple::operator~
Image operator~(const Image &img)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:74
itk::simple::operator^
Image operator^(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:89
itk::simple::Add
Image Add(Image &&image1, const Image &image2)
Pixel-wise addition of two images.
itk::simple::Xor
Image Xor(Image &&image1, const Image &image2)
Computes the XOR bitwise operator pixel-wise between two images.
itk::simple::operator*=
Image & operator*=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:100
sitkUnaryMinusImageFilter.h
itk::simple::BitwiseNot
Image BitwiseNot(Image &&image1)
Implements pixel-wise generic operation on one image.
itk::simple::Multiply
Image Multiply(Image &&image1, const Image &image2)
Pixel-wise multiplication of two images.
itk::simple::operator&=
Image & operator&=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:106
sitkSubtractImageFilter.h
sitkMultiplyImageFilter.h
itk::simple::Divide
Image Divide(Image &&image1, const Image &image2)
Pixel-wise division of two images.
sitkDivideImageFilter.h
itk::simple::operator/
Image operator/(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:59
itk::simple::operator/=
Image & operator/=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:102
itk::simple::And
Image And(Image &&image1, const Image &image2)
Implements the AND bitwise operator pixel-wise between two images.
itk::simple::operator&
Image operator&(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:77
itk::simple::operator%=
Image & operator%=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:104
sitkOrImageFilter.h
sitkXorImageFilter.h
itk::simple::operator-=
Image & operator-=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:98
itk
sitkModulusImageFilter.h
itk::simple::operator+=
Image & operator+=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:96
itk::uint32_t
::uint32_t uint32_t
itk::simple::UnaryMinus
Image UnaryMinus(Image &&image1)
Implements pixel-wise generic operation on one image.
sitkAndImageFilter.h
itk::simple::operator-
Image operator-(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:49
itk::simple::operator+
Image operator+(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:44
itk::simple::operator*
Image operator*(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:54