ITK  6.0.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 
92 template <typename TInputImage1, typename TInputImage2 = TInputImage1, typename TOutputImage = TInputImage1>
93 class ITK_TEMPLATE_EXPORT PowImageFilter : public BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>
96 {
97 public:
98  ITK_DISALLOW_COPY_AND_MOVE(PowImageFilter);
99 
102  using Superclass = BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>;
103 
104  using Pointer = SmartPointer<Self>;
105  using ConstPointer = SmartPointer<const Self>;
106  using FunctorType =
107  Functor::Pow<typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType>;
108 
110  itkNewMacro(Self);
111 
113  itkOverrideGetNameOfClassMacro(PowImageFilter);
114 
115 #ifdef ITK_USE_CONCEPT_CHECKING
116  // Begin concept checking
117  // End concept checking
118 #endif
119 
120 protected:
122  {
123 #if !defined(ITK_WRAPPING_PARSER)
124  Superclass::SetFunctor(FunctorType());
125 #endif
126  }
127 
128  ~PowImageFilter() override = default;
129 };
130 } // end namespace itk
131 
132 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
PowImageFilter
PowImageFilter()
Definition: itkPowImageFilter.h:121
itk::Functor::Pow
Definition: itkPowImageFilter.h:34
FunctorType
Functor::Pow< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
Definition: itkPowImageFilter.h:107
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:97
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:60
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Functor::Pow::ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Pow)
itkNumericTraits.h
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:86
AddImageFilter
Definition: itkAddImageFilter.h:81
~PowImageFilter
~PowImageFilter() override=default
PowImageFilter
Definition: itkPowImageFilter.h:93
itk::Functor::Pow::Pow
Pow()=default
Superclass
BinaryGeneratorImageFilter< TInputImage1, TInputImage2, TOutputImage > Superclass
Definition: itkAddImageFilter.h:90