SimpleITK  1.0.1
sitkImageOperators.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright Insight Software Consortium
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+( const Image &img, double s ) { return Add(img, s ); }
46 inline Image operator+( double s, const Image &img ) { return Add(s, img ); }
47 inline Image operator-( const Image &img1, const Image &img2 ) { return Subtract(img1, img2 ); }
48 inline Image operator-( const Image &img, double s ) { return Subtract(img, s ); }
49 inline Image operator-(double s, const Image &img ) { return Subtract(s, img ); }
50 inline Image operator*( const Image &img1, const Image &img2 ) { return Multiply(img1, img2 ); }
51 inline Image operator*( const Image &img, double s ) { return Multiply(img, s ); }
52 inline Image operator*( double s, const Image &img ) { return Multiply(s, img ); }
53 inline Image operator/( const Image &img1, const Image &img2 ) { return Divide(img1, img2 ); }
54 inline Image operator/( const Image &img, double s ) { return Divide(img, s ); }
55 inline Image operator/( double s, const Image &img ) { return Divide(s, img ); }
56 inline Image operator%( const Image &img1, const Image &img2 ) { return Modulus(img1, img2 ); }
57 inline Image operator%( const Image &img, uint32_t s ) { return Modulus(img, s ); }
58 inline Image operator%( uint32_t s, const Image &img ) { return Modulus(s, img ); }
59 
60 
61 // Modoulo does not appear to be defined?
62 // Image operator%( Image &img1, Image &img2 )
63 // Image &operator%=( Image &img1, double s )
64 
65 inline Image operator-( const Image &img ) { return UnaryMinus( img ); }
66 
67 inline Image operator~( const Image &img ) { return BitwiseNot( img ); }
68 inline Image operator&( const Image &img1, const Image &img2 ) { return And(img1, img2 ); }
69 inline Image operator&( const Image &img, int s ) { return And(img, s ); }
70 inline Image operator&( int s, const Image &img ) { return And(s, img ); }
71 inline Image operator|( const Image &img1, const Image &img2 ) { return Or(img1, img2 ); }
72 inline Image operator|( const Image &img, int s ) { return Or(img, s ); }
73 inline Image operator|( int s, const Image &img ) { return Or(s, img ); }
74 inline Image operator^( const Image &img1, const Image &img2 ) { return Xor(img1, img2 ); }
75 inline Image operator^( const Image &img, int s ) { return Xor(img, s ); }
76 inline Image operator^( int s, const Image &img ) { return Xor(s, img ); }
77 
79 inline Image operator+=( Image &img1, const Image &img2 ) { return img1 = Add(img1, img2 ); }
80 inline Image operator+=( Image &img1, double s ) { return img1 = Add(img1, s ); }
81 inline Image operator-=( Image &img1, const Image &img2 ) { return img1 = Subtract(img1, img2 ); }
82 inline Image operator-=( Image &img1, double s ) { return img1 = Subtract(img1, s ); }
83 inline Image operator*=( Image &img1, const Image &img2 ) { return img1 = Multiply(img1, img2 ); }
84 inline Image operator*=( Image &img1, double s ) { return img1 = Multiply(img1, s ); }
85 inline Image operator/=( Image &img1, const Image &img2 ) { return img1 = Divide(img1, img2 ); }
86 inline Image operator/=( Image &img1, double s ) { return img1 = Divide(img1, s ); }
87 inline Image operator%=( Image &img1, const Image &img2 ) { return img1 = Modulus(img1, img2 ); }
88 inline Image operator%=( Image &img1, uint32_t s ) { return img1 = Modulus(img1, s ); }
89 inline Image operator&=( Image &img1, const Image &img2 ) { return img1 = And(img1, img2 ); }
90 inline Image operator&=( Image &img1, int s ) { return img1 = And(img1, s ); }
91 inline Image operator|=( Image &img1, const Image &img2 ) { return img1 = Or(img1, img2 ); }
92 inline Image operator|=( Image &img1, int s ) { return img1 = Or(img1, s ); }
93 inline Image operator^=( Image &img1, const Image &img2 ) { return img1 = Xor(img1, img2 ); }
94 inline Image operator^=( Image &img1, int s ) { return img1 = Xor(img1, s ); }
96 }
97 }
98 
99 #endif // sitkImageOperators_h
Image Xor(const Image &image1, const Image &image2)
Computes the XOR bitwise operator pixel-wise between two images.
Image Modulus(const Image &image1, const Image &image2)
Computes the modulus (x % dividend) pixel-wise.
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 &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(const Image &image1)
Computes the negative of each pixel.
Image Or(const 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 Divide(const Image &image1, const Image &image2)
Pixel-wise division of two images.
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 BitwiseNot(const Image &image1)
Implements pixel-wise generic operation on one image.
Image Add(const Image &image1, const Image &image2)
Pixel-wise addition of 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.
::uint32_t uint32_t
The main Image class for SimpleITK.
Definition: sitkImage.h:54
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 Subtract(const Image &image1, const Image &image2)
Pixel-wise subtraction of two images.
Image operator+=(Image &img1, const Image &img2)
Image And(const 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 operator*=(Image &img1, const Image &img2)
Performs the operator on a per pixel basis.
Image Multiply(const Image &image1, const Image &image2)
Pixel-wise multiplication of two images.
Image operator-(const Image &img1, const Image &img2)
Performs the operator on a per pixel basis.