ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkSubtractImageFilter.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 __itkSubtractImageFilter_h
19 #define __itkSubtractImageFilter_h
20 
22 
23 namespace itk
24 {
25 namespace Functor
26 {
32 template< typename TInput1, typename TInput2 = TInput1, typename TOutput = TInput1 >
33 class Sub2
34 {
35 public:
36  Sub2() {}
37  ~Sub2() {}
38  bool operator!=(const Sub2 &) const
39  {
40  return false;
41  }
43 
44  bool operator==(const Sub2 & other) const
45  {
46  return !( *this != other );
47  }
48 
49  inline TOutput operator()(const TInput1 & A, const TInput2 & B) const
50  { return (TOutput)( A - B ); }
51 };
52 }
93 template< typename TInputImage1, typename TInputImage2 = TInputImage1, typename TOutputImage = TInputImage1 >
95  public
96  BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage,
97  Functor::Sub2<
98  typename TInputImage1::PixelType,
99  typename TInputImage2::PixelType,
100  typename TOutputImage::PixelType > >
101 {
102 public:
105  typedef BinaryFunctorImageFilter<
106  TInputImage1, TInputImage2, TOutputImage,
107  Functor::Sub2< typename TInputImage1::PixelType,
108  typename TInputImage2::PixelType,
109  typename TOutputImage::PixelType > > Superclass;
110 
113 
115  itkNewMacro(Self);
116 
118  itkTypeMacro(SubtractImageFilter,
120 
121 #ifdef ITK_USE_CONCEPT_CHECKING
122  // Begin concept checking
123  itkConceptMacro( Input1Input2OutputAdditiveOperatorsCheck,
124  ( Concept::AdditiveOperators< typename TInputImage1::PixelType,
125  typename TInputImage2::PixelType,
126  typename TOutputImage::PixelType > ) );
127  // End concept checking
128 #endif
129 
130 protected:
132  virtual ~SubtractImageFilter() {}
133 
134 private:
135  SubtractImageFilter(const Self &); //purposely not implemented
136  void operator=(const Self &); //purposely not implemented
137 };
138 } // end namespace itk
139 
140 #endif
SmartPointer< const Self > ConstPointer
Pixel-wise subtraction of two images.
BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, Functor::Sub2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > > Superclass
Base class for all process objects that output image data.
TOutput operator()(const TInput1 &A, const TInput2 &B) const
bool operator!=(const Sub2 &) const
bool operator==(const Sub2 &other) const
void operator=(const Self &)
#define itkConceptMacro(name, concept)
Implements pixel-wise generic operation of two images, or of an image and a constant.