ITK  6.0.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  * 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 itkExpNegativeImageFilter_h
19 #define itkExpNegativeImageFilter_h
20 
22 #include "itkMath.h"
23 
24 namespace itk
25 {
26 namespace Functor
27 {
33 template <typename TInput, typename TOutput>
35 {
36 public:
37  ExpNegative() { m_Factor = 1.0; }
38  ~ExpNegative() = default;
42  bool
43  operator==(const ExpNegative & other) const
44  {
45  return Math::ExactlyEquals(m_Factor, other.m_Factor);
46  }
47 
49 
50  inline TOutput
51  operator()(const TInput & A) const
52  {
53  return static_cast<TOutput>(std::exp(-m_Factor * static_cast<double>(A)));
54  }
55 
57  void
58  SetFactor(double factor)
59  {
60  m_Factor = factor;
61  }
62 
63  double
64  GetFactor() const
65  {
66  return m_Factor;
67  }
68 
69 private:
70  double m_Factor;
71 };
72 } // namespace Functor
73 
87 template <typename TInputImage, typename TOutputImage>
89  : public UnaryFunctorImageFilter<
90  TInputImage,
91  TOutputImage,
92  Functor::ExpNegative<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
93 {
94 public:
95  ITK_DISALLOW_COPY_AND_MOVE(ExpNegativeImageFilter);
96 
99  using Superclass =
100  UnaryFunctorImageFilter<TInputImage,
101  TOutputImage,
103 
106 
108  itkNewMacro(Self);
109 
111  itkOverrideGetNameOfClassMacro(ExpNegativeImageFilter);
112 
113  void
114  SetFactor(double factor)
115  {
116  if (factor == this->GetFunctor().GetFactor())
117  {
118  return;
119  }
120  this->GetFunctor().SetFactor(factor);
121  this->Modified();
122  }
123  double
124  GetFactor() const
125  {
126  return this->GetFunctor().GetFactor();
127  }
128 
129 #ifdef ITK_USE_CONCEPT_CHECKING
130  // Begin concept checking
133  // End concept checking
134 #endif
135 
136 protected:
137  ExpNegativeImageFilter() = default;
138  ~ExpNegativeImageFilter() override = default;
139 };
140 } // end namespace itk
141 
142 #endif
itkUnaryFunctorImageFilter.h
itk::ExpNegativeImageFilter
Computes the function exp(-K.x) for each input pixel.
Definition: itkExpNegativeImageFilter.h:88
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:722
itk::Functor::ExpNegative::SetFactor
void SetFactor(double factor)
Definition: itkExpNegativeImageFilter.h:58
itk::ExpNegativeImageFilter::~ExpNegativeImageFilter
~ExpNegativeImageFilter() override=default
itk::SmartPointer< Self >
itk::Functor::ExpNegative
Definition: itkExpNegativeImageFilter.h:34
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:114
itk::Functor::ExpNegative::~ExpNegative
~ExpNegative()=default
itk::Functor::ExpNegative::GetFactor
double GetFactor() const
Definition: itkExpNegativeImageFilter.h:64
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Functor::ExpNegative::operator()
TOutput operator()(const TInput &A) const
Definition: itkExpNegativeImageFilter.h:51
itk::Functor::ExpNegative::m_Factor
double m_Factor
Definition: itkExpNegativeImageFilter.h:70
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::Concept::Convertible
Definition: itkConceptChecking.h:217
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:43
itk::Functor::ExpNegative::ExpNegative
ExpNegative()
Definition: itkExpNegativeImageFilter.h:37
itk::Object::Modified
virtual void Modified() const
itkMath.h
itk::ExpNegativeImageFilter::GetFactor
double GetFactor() const
Definition: itkExpNegativeImageFilter.h:124
itk::Functor::ExpNegative::ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(ExpNegative)