SimpleITK  
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::simple {
33 
43 inline Image operator+( const Image &img1, const Image &img2 ) { return Add(img1, img2 ); }
44 inline Image operator+( Image &&img1, const Image &img2 ) { return Add(std::move(img1), img2 ); }
45 inline Image operator+( const Image &img, double s ) { return Add(img, s ); }
46 inline Image operator+( Image &&img, double s ) { return Add(std::move(img), s ); }
47 inline Image operator+( double s, const Image &img ) { return Add(s, img ); }
48 inline Image operator-( const Image &img1, const Image &img2 ) { return Subtract(img1, img2 ); }
49 inline Image operator-( Image &&img1, const Image &img2 ) { return Subtract(std::move(img1), img2 ); }
50 inline Image operator-( const Image &img, double s ) { return Subtract(img, s ); }
51 inline Image operator-( Image &&img, double s ) { return Subtract(std::move(img), s ); }
52 inline Image operator-( double s, const Image &img ) { return Subtract(s, img ); }
53 inline Image operator*( const Image &img1, const Image &img2 ) { return Multiply(img1, img2 ); }
54 inline Image operator*( Image &&img1, const Image &img2 ) { return Multiply(std::move(img1), img2 ); }
55 inline Image operator*( const Image &img, double s ) { return Multiply(img, s ); }
56 inline Image operator*( Image &&img, double s ) { return Multiply(std::move(img), s ); }
57 inline Image operator*( double s, const Image &img ) { return Multiply(s, img ); }
58 inline Image operator/( const Image &img1, const Image &img2 ) { return Divide(img1, img2 ); }
59 inline Image operator/( Image &&img1, const Image &img2 ) { return Divide(std::move(img1), img2 ); }
60 inline Image operator/( const Image &img, double s ) { return Divide(img, s ); }
61 inline Image operator/( Image &&img, double s ) { return Divide(std::move(img), s ); }
62 inline Image operator/( double s, const Image &img ) { return Divide(s, img ); }
63 inline Image operator%( const Image &img1, const Image &img2 ) { return Modulus(img1, img2 ); }
64 inline Image operator%( Image &&img1, const Image &img2 ) { return Modulus(std::move(img1), img2 ); }
65 inline Image operator%( const Image &img, uint32_t s ) { return Modulus(img, s ); }
66 inline Image operator%( Image &&img, uint32_t s ) { return Modulus(std::move(img), s ); }
67 inline Image operator%( uint32_t s, const Image &img ) { return Modulus(s, img ); }
68 
69 inline Image operator-( const Image &img ) { return UnaryMinus( img ); }
70 inline Image operator-( Image &&img ) { return UnaryMinus( std::move(img) ); }
71 
72 
73 inline Image operator~( const Image &img ) { return BitwiseNot( img ); }
74 inline Image operator~( Image &&img ) { return BitwiseNot( std::move(img) ); }
75 
76 inline Image operator&( const Image &img1, const Image &img2 ) { return And(img1, img2 ); }
77 inline Image operator&( Image &&img1, const Image &img2 ) { return And(std::move(img1), img2 ); }
78 inline Image operator&( const Image &img, int s ) { return And(img, s ); }
79 inline Image operator&( Image &&img, int s ) { return And(std::move(img), s ); }
80 inline Image operator&( int s, const Image &img ) { return And(s, img ); }
81 
82 inline Image operator|( const Image &img1, const Image &img2 ) { return Or(img1, img2 ); }
83 inline Image operator|( Image &&img1, const Image &img2 ) { return Or(std::move(img1), img2 ); }
84 inline Image operator|( const Image &img, int s ) { return Or(img, s ); }
85 inline Image operator|( Image &&img, int s ) { return Or(std::move(img), s ); }
86 inline Image operator|( int s, const Image &img ) { return Or(s, img ); }
87 
88 inline Image operator^( const Image &img1, const Image &img2 ) { return Xor(img1, img2 ); }
89 inline Image operator^( Image &&img1, const Image &img2 ) { return Xor(std::move(img1), img2 ); }
90 inline Image operator^( const Image &img, int s ) { return Xor(img, s ); }
91 inline Image operator^( Image &&img, int s ) { return Xor(std::move(img), s ); }
92 inline Image operator^( int s, const Image &img ) { return Xor(s, img ); }
93 
94 
95 inline Image &operator+=( Image &img1, const Image &img2 ) { Add(img1.ProxyForInPlaceOperation(), img2 ); return img1;}
96 inline Image &operator+=( Image &img1, double s ) { Add(img1.ProxyForInPlaceOperation(), s ); return img1;}
97 inline Image &operator-=( Image &img1, const Image &img2 ) { Subtract(img1.ProxyForInPlaceOperation(), img2 ); return img1;}
98 inline Image &operator-=( Image &img1, double s ) { Subtract(img1.ProxyForInPlaceOperation(), s ); return img1;}
99 inline Image &operator*=( Image &img1, const Image &img2 ) { Multiply(img1.ProxyForInPlaceOperation(), img2 ); return img1;}
100 inline Image &operator*=( Image &img1, double s ) { Multiply(img1.ProxyForInPlaceOperation(), s ); return img1;}
101 inline Image &operator/=( Image &img1, const Image &img2 ) { Divide(img1.ProxyForInPlaceOperation(), img2 ); return img1;}
102 inline Image &operator/=( Image &img1, double s ) { Divide(img1.ProxyForInPlaceOperation(), s ); return img1;}
103 inline Image &operator%=( Image &img1, const Image &img2 ) { Modulus(img1.ProxyForInPlaceOperation(), img2 ); return img1;}
104 inline Image &operator%=( Image &img1, uint32_t s ) { Modulus(img1.ProxyForInPlaceOperation(), s ); return img1;}
105 inline Image &operator&=( Image &img1, const Image &img2 ) { And(img1.ProxyForInPlaceOperation(), img2 ); return img1;}
106 inline Image &operator&=( Image &img1, int s ) { And(img1.ProxyForInPlaceOperation(), s ); return img1;}
107 inline Image &operator|=( Image &img1, const Image &img2 ) { Or(img1.ProxyForInPlaceOperation(), img2 ); return img1;}
108 inline Image &operator|=( Image &img1, int s ) { Or(img1.ProxyForInPlaceOperation(), s ); return img1;}
109 inline Image &operator^=( Image &img1, const Image &img2 ) { Xor(img1.ProxyForInPlaceOperation(), img2 ); return img1;}
110 inline Image &operator^=( Image &img1, int s ) { Xor(img1.ProxyForInPlaceOperation(), s ); return img1;}
112 }
113 
114 #endif // sitkImageOperators_h
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:76
itk::simple::operator|=
Image & operator|=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:107
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:63
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:82
itk::simple::operator^=
Image & operator^=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:109
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:73
itk::simple::operator^
Image operator^(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:88
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:99
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:105
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:58
itk::simple::operator/=
Image & operator/=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:101
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:76
itk::simple::Image::ProxyForInPlaceOperation
Image ProxyForInPlaceOperation()
Advanced method not commonly needed.
itk::simple::operator%=
Image & operator%=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:103
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:97
sitkModulusImageFilter.h
itk::simple::operator+=
Image & operator+=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:95
itk::simple
Definition: sitkAdditionalProcedures.h:28
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:48
itk::simple::operator+
Image operator+(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:43
itk::simple::operator*
Image operator*(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Definition: sitkImageOperators.h:53