ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkExpNegativeImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 operator!=(const ExpNegative & other) const
43  {
45  {
46  return true;
47  }
48  return false;
49  }
50 
51  bool operator==(const ExpNegative & other) const
52  {
53  return !( *this != other );
54  }
55 
56  inline TOutput operator()(const TInput & A) const
57  {
58  return static_cast< TOutput >( std::exp( -m_Factor * static_cast< double >( A ) ) );
59  }
60 
62  void SetFactor(double factor)
63  {
64  m_Factor = factor;
65  }
66 
67  double GetFactor() const
68  {
69  return m_Factor;
70  }
71 
72 private:
73  double m_Factor;
74 };
75 }
76 
89 template< typename TInputImage, typename TOutputImage >
91  public
92  UnaryFunctorImageFilter< TInputImage, TOutputImage,
93  Functor::ExpNegative<
94  typename TInputImage::PixelType,
95  typename TOutputImage::PixelType > >
96 {
97 public:
98  ITK_DISALLOW_COPY_AND_ASSIGN(ExpNegativeImageFilter);
99 
103  TInputImage, TOutputImage,
104  Functor::ExpNegative< typename TInputImage::PixelType,
105  typename TOutputImage::PixelType > >;
106 
109 
111  itkNewMacro(Self);
112 
114  itkTypeMacro(ExpNegativeImageFilter,
116 
117  void SetFactor(double factor)
118  {
119  if ( factor == this->GetFunctor().GetFactor() )
120  {
121  return;
122  }
123  this->GetFunctor().SetFactor(factor);
124  this->Modified();
125  }
126  double GetFactor() const
127  {
128  return this->GetFunctor().GetFactor();
129  }
130 
131 #ifdef ITK_USE_CONCEPT_CHECKING
132  // Begin concept checking
133  itkConceptMacro( InputConvertibleToDoubleCheck,
135  itkConceptMacro( DoubleConvertibleToOutputCheck,
137  // End concept checking
138 #endif
139 
140 protected:
141  ExpNegativeImageFilter() = default;
142  ~ExpNegativeImageFilter() override = default;
143 };
144 } // end namespace itk
145 
146 #endif
bool operator!=(const ExpNegative &other) const
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
bool operator==(const ExpNegative &other) const
~ExpNegativeImageFilter() override=default
Computes the function exp(-K.x) for each input pixel.
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition: itkMath.h:718
virtual void Modified() const
Implements pixel-wise generic operation on one image.
TOutput operator()(const TInput &A) const
#define itkConceptMacro(name, concept)