ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkTernaryAddImageFilter.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 __itkTernaryAddImageFilter_h
19 #define __itkTernaryAddImageFilter_h
20 
22 
23 namespace itk
24 {
25 namespace Functor
26 {
32 template< class TInput1, class TInput2, class TInput3, class TOutput >
33 class Add3
34 {
35 public:
36  Add3() {}
37  ~Add3() {}
38  bool operator!=(const Add3 &) const
39  {
40  return false;
41  }
43 
44  bool operator==(const Add3 & other) const
45  {
46  return !( *this != other );
47  }
48 
49  inline TOutput operator()(const TInput1 & A,
50  const TInput2 & B,
51  const TInput3 & C) const
52  { return (TOutput)( A + B + C ); }
53 };
54 }
65 template< class TInputImage1, class TInputImage2,
66  class TInputImage3, class TOutputImage >
67 class ITK_EXPORT TernaryAddImageFilter:
68  public
69  TernaryFunctorImageFilter< TInputImage1, TInputImage2,
70  TInputImage3, TOutputImage,
71  Functor::Add3< typename TInputImage1::PixelType,
72  typename TInputImage2::PixelType,
73  typename TInputImage3::PixelType,
74  typename TOutputImage::PixelType > >
75 {
76 public:
80  TInputImage1, TInputImage2,
81  TInputImage3, TOutputImage,
82  Functor::Add3< typename TInputImage1::PixelType,
83  typename TInputImage2::PixelType,
84  typename TInputImage3::PixelType,
85  typename TOutputImage::PixelType > > Superclass;
86 
89 
91  itkNewMacro(Self);
92 
94  itkTypeMacro(TernaryAddImageFilter,
96 protected:
99 private:
100  TernaryAddImageFilter(const Self &); //purposely not implemented
101  void operator=(const Self &); //purposely not implemented
102 };
103 } // end namespace itk
105 
106 #endif
107