ITK  4.13.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 RealType1;
55  typedef typename NumericTraits< TInput2 >::RealType RealType2;
56  return static_cast< TOutput >( std::pow(static_cast<RealType1>(A),static_cast<RealType2>(B)) );
57  }
58 };
59 }
92 template< typename TInputImage1, typename TInputImage2 = TInputImage1, typename TOutputImage = TInputImage1 >
94  public
95  BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage,
96  Functor::Pow<
97  typename TInputImage1::PixelType,
98  typename TInputImage2::PixelType,
99  typename TOutputImage::PixelType > >
100 
101 {
102 public:
105  typedef BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage,
106  Functor::Pow<
107  typename TInputImage1::PixelType,
108  typename TInputImage2::PixelType,
109  typename TOutputImage::PixelType > > Superclass;
110 
113 
115  itkNewMacro(Self);
116 
118  itkTypeMacro(PowImageFilter,
120 
121 #ifdef ITK_USE_CONCEPT_CHECKING
122  // Begin concept checking
123  // End concept checking
124 #endif
125 
126 protected:
128  // virtual ~PowImageFilter() {} default implementation OK
129 
130 private:
131  ITK_DISALLOW_COPY_AND_ASSIGN(PowImageFilter);
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