ITK  5.3.0
Insight Toolkit
itkExpNegativeImageFilter.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 itkExpNegativeImageFilter_h
19 #define itkExpNegativeImageFilter_h
20 
22 #include "itkMath.h"
23 #include "itkMath.h"
24 
25 namespace itk
26 {
27 namespace Functor
28 {
34 template <typename TInput, typename TOutput>
36 {
37 public:
38  ExpNegative() { m_Factor = 1.0; }
39  ~ExpNegative() = default;
41 
42 
43  bool
44  operator==(const ExpNegative & other) const
45  {
46  return Math::ExactlyEquals(m_Factor, other.m_Factor);
47  }
48 
50 
51  inline TOutput
52  operator()(const TInput & A) const
53  {
54  return static_cast<TOutput>(std::exp(-m_Factor * static_cast<double>(A)));
55  }
56 
58  void
59  SetFactor(double factor)
60  {
61  m_Factor = factor;
62  }
63 
64  double
65  GetFactor() const
66  {
67  return m_Factor;
68  }
69 
70 private:
71  double m_Factor;
72 };
73 } // namespace Functor
74 
88 template <typename TInputImage, typename TOutputImage>
90  : public UnaryFunctorImageFilter<
91  TInputImage,
92  TOutputImage,
93  Functor::ExpNegative<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
94 {
95 public:
96  ITK_DISALLOW_COPY_AND_MOVE(ExpNegativeImageFilter);
97 
100  using Superclass =
101  UnaryFunctorImageFilter<TInputImage,
102  TOutputImage,
104 
107 
109  itkNewMacro(Self);
110 
113 
114  void
115  SetFactor(double factor)
116  {
117  if (factor == this->GetFunctor().GetFactor())
118  {
119  return;
120  }
121  this->GetFunctor().SetFactor(factor);
122  this->Modified();
123  }
124  double
125  GetFactor() const
126  {
127  return this->GetFunctor().GetFactor();
128  }
129 
130 #ifdef ITK_USE_CONCEPT_CHECKING
131  // Begin concept checking
134  // End concept checking
135 #endif
136 
137 protected:
138  ExpNegativeImageFilter() = default;
139  ~ExpNegativeImageFilter() override = default;
140 };
141 } // end namespace itk
142 
143 #endif
itkUnaryFunctorImageFilter.h
itk::ExpNegativeImageFilter
Computes the function exp(-K.x) for each input pixel.
Definition: itkExpNegativeImageFilter.h:89
itk::UnaryFunctorImageFilter
Implements pixel-wise generic operation on one image.
Definition: itkUnaryFunctorImageFilter.h:50
itk::ExpNegativeImageFilter::ExpNegativeImageFilter
ExpNegativeImageFilter()=default
itk::Math::ExactlyEquals
bool ExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Return the result of an exact comparison between two scalar values of potentially different types.
Definition: itkMath.h:723
itk::Functor::ExpNegative::SetFactor
void SetFactor(double factor)
Definition: itkExpNegativeImageFilter.h:59
itk::ExpNegativeImageFilter::~ExpNegativeImageFilter
~ExpNegativeImageFilter() override=default
itk::SmartPointer< Self >
itk::Functor::ExpNegative
Definition: itkExpNegativeImageFilter.h:35
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ExpNegativeImageFilter::SetFactor
void SetFactor(double factor)
Definition: itkExpNegativeImageFilter.h:115
itk::Functor::ExpNegative::~ExpNegative
~ExpNegative()=default
itk::Functor::ExpNegative::GetFactor
double GetFactor() const
Definition: itkExpNegativeImageFilter.h:65
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Functor::ExpNegative::operator()
TOutput operator()(const TInput &A) const
Definition: itkExpNegativeImageFilter.h:52
itk::Functor::ExpNegative::m_Factor
double m_Factor
Definition: itkExpNegativeImageFilter.h:71
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::ExpNegative< TInputImage::PixelType, TOutputImage::PixelType > >::GetFunctor
FunctorType & GetFunctor()
Definition: itkUnaryFunctorImageFilter.h:85
itk::Functor::ExpNegative::operator==
bool operator==(const ExpNegative &other) const
Definition: itkExpNegativeImageFilter.h:44
itk::Functor::ExpNegative::ExpNegative
ExpNegative()
Definition: itkExpNegativeImageFilter.h:38
itk::Object::Modified
virtual void Modified() const
itkMath.h
itk::ExpNegativeImageFilter::GetFactor
double GetFactor() const
Definition: itkExpNegativeImageFilter.h:125
itk::Functor::ExpNegative::ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(ExpNegative)