ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkPowImageFilter.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 __itkPowImageFilter_h
19 #define __itkPowImageFilter_h
20 
22 #include "itkNumericTraits.h"
23 
24 namespace itk
25 {
26 namespace Functor
27 {
33 template< class TInput1, class TInput2 = TInput1, class TOutput = TInput1 >
34 class Pow
35 {
36 public:
37  ;
38  Pow() {}
39  bool operator!=(const Pow &) const
40  {
41  // we contain no data, so we are always the same
42  return false;
43  }
45 
46  bool operator==(const Pow & other) const
47  {
48  return !( *this != other );
49  }
50 
51  inline TOutput operator()(const TInput1 & A, const TInput2 & B) const
52  {
53 
54  typedef typename NumericTraits< TInput1 >::RealType RealType;
55  return static_cast< TOutput >( vcl_pow(static_cast<RealType>(A),static_cast<RealType>(B)) );
56  }
57 };
58 }
91 template< class TInputImage1, class TInputImage2 = TInputImage1, class TOutputImage = TInputImage1 >
92 class ITK_EXPORT PowImageFilter:
93  public
94  BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage,
95  Functor::Pow<
96  typename TInputImage1::PixelType,
97  typename TInputImage2::PixelType,
98  typename TOutputImage::PixelType > >
99 
100 {
101 public:
104  typedef BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage,
105  Functor::Pow<
106  typename TInputImage1::PixelType,
107  typename TInputImage2::PixelType,
108  typename TOutputImage::PixelType > > Superclass;
109 
112 
114  itkNewMacro(Self);
115 
117  itkTypeMacro(PowImageFilter,
119 
120 #ifdef ITK_USE_CONCEPT_CHECKING
121 
124 #endif
125 
126 protected:
128  // virtual ~PowImageFilter() {} default implementation OK
129 
130 private:
131  PowImageFilter(const Self &); //purposely not implemented
132  void operator=(const Self &); //purposely not implemented
133 };
134 } // end namespace itk
135 
136 #endif
137