ITK  5.2.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  bool
43  operator!=(const ExpNegative & other) const
44  {
46  {
47  return true;
48  }
49  return false;
50  }
51 
52  bool
53  operator==(const ExpNegative & other) const
54  {
55  return !(*this != other);
56  }
57 
58  inline TOutput
59  operator()(const TInput & A) const
60  {
61  return static_cast<TOutput>(std::exp(-m_Factor * static_cast<double>(A)));
62  }
63 
65  void
66  SetFactor(double factor)
67  {
68  m_Factor = factor;
69  }
70 
71  double
72  GetFactor() const
73  {
74  return m_Factor;
75  }
76 
77 private:
78  double m_Factor;
79 };
80 } // namespace Functor
81 
95 template <typename TInputImage, typename TOutputImage>
97  : public UnaryFunctorImageFilter<
98  TInputImage,
99  TOutputImage,
100  Functor::ExpNegative<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
101 {
102 public:
103  ITK_DISALLOW_COPY_AND_MOVE(ExpNegativeImageFilter);
104 
107  using Superclass =
108  UnaryFunctorImageFilter<TInputImage,
109  TOutputImage,
111 
114 
116  itkNewMacro(Self);
117 
120 
121  void
122  SetFactor(double factor)
123  {
124  if (factor == this->GetFunctor().GetFactor())
125  {
126  return;
127  }
128  this->GetFunctor().SetFactor(factor);
129  this->Modified();
130  }
131  double
132  GetFactor() const
133  {
134  return this->GetFunctor().GetFactor();
135  }
136 
137 #ifdef ITK_USE_CONCEPT_CHECKING
138  // Begin concept checking
141  // End concept checking
142 #endif
143 
144 protected:
145  ExpNegativeImageFilter() = default;
146  ~ExpNegativeImageFilter() override = default;
147 };
148 } // end namespace itk
149 
150 #endif
itkUnaryFunctorImageFilter.h
itk::ExpNegativeImageFilter
Computes the function exp(-K.x) for each input pixel.
Definition: itkExpNegativeImageFilter.h:96
itk::UnaryFunctorImageFilter
Implements pixel-wise generic operation on one image.
Definition: itkUnaryFunctorImageFilter.h:50
itk::ExpNegativeImageFilter::ExpNegativeImageFilter
ExpNegativeImageFilter()=default
itk::Functor::ExpNegative::SetFactor
void SetFactor(double factor)
Definition: itkExpNegativeImageFilter.h:66
itk::ExpNegativeImageFilter::~ExpNegativeImageFilter
~ExpNegativeImageFilter() override=default
itk::SmartPointer< Self >
itk::Math::NotExactlyEquals
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition: itkMath.h:733
itk::Functor::ExpNegative
Definition: itkExpNegativeImageFilter.h:35
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Functor::ExpNegative::operator!=
bool operator!=(const ExpNegative &other) const
Definition: itkExpNegativeImageFilter.h:43
itk::ExpNegativeImageFilter::SetFactor
void SetFactor(double factor)
Definition: itkExpNegativeImageFilter.h:122
itk::Functor::ExpNegative::~ExpNegative
~ExpNegative()=default
itk::Functor::ExpNegative::GetFactor
double GetFactor() const
Definition: itkExpNegativeImageFilter.h:72
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:59
itk::Functor::ExpNegative::m_Factor
double m_Factor
Definition: itkExpNegativeImageFilter.h:78
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:53
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:132