ITK  5.4.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
24namespace itk
25{
26namespace Functor
27{
33template <typename TInput, typename TOutput>
35{
36public:
37 ExpNegative() { m_Factor = 1.0; }
38 ~ExpNegative() = default;
42 bool
43 operator==(const ExpNegative & other) const
44 {
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
69private:
70 double m_Factor;
71};
72} // namespace Functor
73
87template <typename TInputImage, typename TOutputImage>
90 TInputImage,
91 TOutputImage,
92 Functor::ExpNegative<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
93{
94public:
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
136protected:
138 ~ExpNegativeImageFilter() override = default;
139};
140} // end namespace itk
141
142#endif
Computes the function exp(-K.x) for each input pixel.
~ExpNegativeImageFilter() override=default
TOutput operator()(const TInput &A) const
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(ExpNegative)
bool operator==(const ExpNegative &other) const
Base class for all process objects that output image data.
virtual void Modified() const
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Implements pixel-wise generic operation on one image.
#define itkConceptMacro(name, concept)
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:726
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....