ITK  5.2.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  * 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  Pow() = default;
38  bool
39  operator!=(const Pow &) const
40  {
41  // we contain no data, so we are always the same
42  return false;
43  }
45 
46  bool
47  operator==(const Pow & other) const
48  {
49  return !(*this != other);
50  }
51 
52  inline TOutput
53  operator()(const TInput1 & A, const TInput2 & B) const
54  {
55 
56  using RealType1 = typename NumericTraits<TInput1>::RealType;
57  using RealType2 = typename NumericTraits<TInput2>::RealType;
58  return static_cast<TOutput>(std::pow(static_cast<RealType1>(A), static_cast<RealType2>(B)));
59  }
60 };
61 } // namespace Functor
62 
96 template <typename TInputImage1, typename TInputImage2 = TInputImage1, typename TOutputImage = TInputImage1>
97 class PowImageFilter : public BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>
99 
100 {
101 public:
102  ITK_DISALLOW_COPY_AND_MOVE(PowImageFilter);
103 
107 
110  using FunctorType =
112 
114  itkNewMacro(Self);
115 
118 
119 #ifdef ITK_USE_CONCEPT_CHECKING
120  // Begin concept checking
121  // End concept checking
122 #endif
123 
124 protected:
126  {
127 #if !defined(ITK_WRAPPING_PARSER)
129 #endif
130  }
131 
132  ~PowImageFilter() override = default;
133 };
134 } // end namespace itk
135 
136 #endif
itk::Functor::Pow
Definition: itkPowImageFilter.h:34
itk::PowImageFilter::PowImageFilter
PowImageFilter()
Definition: itkPowImageFilter.h:125
itk::PowImageFilter::FunctorType
Functor::Pow< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
Definition: itkPowImageFilter.h:111
itk::BinaryGeneratorImageFilter
Implements pixel-wise generic operation of two images, or of an image and a constant.
Definition: itkBinaryGeneratorImageFilter.h:56
itk::SmartPointer< Self >
itk::PowImageFilter
Computes the powers of 2 images.
Definition: itkPowImageFilter.h:97
itkBinaryGeneratorImageFilter.h
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Functor::Pow::operator()
TOutput operator()(const TInput1 &A, const TInput2 &B) const
Definition: itkPowImageFilter.h:53
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk::PowImageFilter::~PowImageFilter
~PowImageFilter() override=default
itk::Functor::Pow::operator!=
bool operator!=(const Pow &) const
Definition: itkPowImageFilter.h:39
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itkNumericTraits.h
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:84
itk::Functor::Pow::Pow
Pow()=default
itk::BinaryGeneratorImageFilter::SetFunctor
void SetFunctor(const std::function< ConstRefFunctionType > &f)
Definition: itkBinaryGeneratorImageFilter.h:150
itk::Functor::Pow::operator==
bool operator==(const Pow &other) const
Definition: itkPowImageFilter.h:47