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
24namespace itk
25{
26namespace Functor
27{
33template <typename TInput1, typename TInput2 = TInput1, typename TOutput = TInput1>
34class Pow
35{
36public:
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
92template <typename TInputImage1, typename TInputImage2 = TInputImage1, typename TOutputImage = TInputImage1>
93class ITK_TEMPLATE_EXPORT PowImageFilter : public BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>
96{
97public:
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>;
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
120protected:
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
Pixel-wise addition of two images.
Computes the powers of 2 images.
bool operator==(const Pow &) const
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Pow)
TOutput operator()(const TInput1 &A, const TInput2 &B) const
Define additional traits for native types such as int or float.
Functor::Add2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
SmartPointer< const Self > ConstPointer
BinaryGeneratorImageFilter< TInputImage1, TInputImage2, TOutputImage > Superclass
SmartPointer< Self > Pointer
Functor::Pow< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
PowImageFilter()
~PowImageFilter() override=default
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....