ITK  4.9.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< typename TInput1, typename TInput2 = TInput1, typename 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 >( std::pow(static_cast<RealType>(A),static_cast<RealType>(B)) );
56  }
57 };
58 }
91 template< typename TInputImage1, typename TInputImage2 = TInputImage1, typename TOutputImage = TInputImage1 >
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  // Begin concept checking
122  // End concept checking
123 #endif
124 
125 protected:
127  // virtual ~PowImageFilter() {} default implementation OK
128 
129 private:
130  PowImageFilter(const Self &) ITK_DELETE_FUNCTION;
131  void operator=(const Self &) ITK_DELETE_FUNCTION;
132 };
133 } // end namespace itk
134 
135 #endif
BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, Functor::Pow< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > > Superclass
TOutput operator()(const TInput1 &A, const TInput2 &B) const
SmartPointer< const Self > ConstPointer
Base class for all process objects that output image data.
Computes the powers of 2 images.
SmartPointer< Self > Pointer
Define additional traits for native types such as int or float.
bool operator==(const Pow &other) const
Implements pixel-wise generic operation of two images, or of an image and a constant.
bool operator!=(const Pow &) const