ITK  5.3.0
Insight Toolkit
itkPowImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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  Pow() = default;
38 
39  bool
40  operator==(const Pow &) const
41  {
42  return true;
43  }
44 
46 
47  inline TOutput
48  operator()(const TInput1 & A, const TInput2 & B) const
49  {
50 
51  using RealType1 = typename NumericTraits<TInput1>::RealType;
52  using RealType2 = typename NumericTraits<TInput2>::RealType;
53  return static_cast<TOutput>(std::pow(static_cast<RealType1>(A), static_cast<RealType2>(B)));
54  }
55 };
56 } // namespace Functor
57 
91 template <typename TInputImage1, typename TInputImage2 = TInputImage1, typename TOutputImage = TInputImage1>
92 class ITK_TEMPLATE_EXPORT PowImageFilter : public BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>
95 {
96 public:
97  ITK_DISALLOW_COPY_AND_MOVE(PowImageFilter);
98 
101  using Superclass = BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>;
102 
103  using Pointer = SmartPointer<Self>;
104  using ConstPointer = SmartPointer<const Self>;
105  using FunctorType =
106  Functor::Pow<typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType>;
107 
109  itkNewMacro(Self);
110 
112  itkTypeMacro(PowImageFilter, BinaryGeneratorImageFilter);
113 
114 #ifdef ITK_USE_CONCEPT_CHECKING
115  // Begin concept checking
116  // End concept checking
117 #endif
118 
119 protected:
121  {
122 #if !defined(ITK_WRAPPING_PARSER)
123  Superclass::SetFunctor(FunctorType());
124 #endif
125  }
126 
127  ~PowImageFilter() override = default;
128 };
129 } // end namespace itk
130 
131 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:92
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:93
PowImageFilter
PowImageFilter()
Definition: itkPowImageFilter.h:120
itk::Functor::Pow
Definition: itkPowImageFilter.h:34
FunctorType
Functor::Pow< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
Definition: itkPowImageFilter.h:106
itk::Functor::Pow::operator==
bool operator==(const Pow &) const
Definition: itkPowImageFilter.h:40
itkBinaryGeneratorImageFilter.h
FunctorType
Functor::Add2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
Definition: itkAddImageFilter.h:96
itk::Functor::Pow::operator()
TOutput operator()(const TInput1 &A, const TInput2 &B) const
Definition: itkPowImageFilter.h:48
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Functor::Pow::ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Pow)
itkNumericTraits.h
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:84
AddImageFilter
Definition: itkAddImageFilter.h:80
~PowImageFilter
~PowImageFilter() override=default
PowImageFilter
Definition: itkPowImageFilter.h:92
itk::Functor::Pow::Pow
Pow()=default
Superclass
BinaryGeneratorImageFilter< TInputImage1, TInputImage2, TOutputImage > Superclass
Definition: itkAddImageFilter.h:89