ITK  4.13.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; }
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 }
88 template< typename TInputImage, typename TOutputImage >
90  public
91  UnaryFunctorImageFilter< TInputImage, TOutputImage,
92  Functor::ExpNegative<
93  typename TInputImage::PixelType,
94  typename TOutputImage::PixelType > >
95 {
96 public:
100  TInputImage, TOutputImage,
101  Functor::ExpNegative< typename TInputImage::PixelType,
102  typename TOutputImage::PixelType > > Superclass;
103 
106 
108  itkNewMacro(Self);
109 
111  itkTypeMacro(ExpNegativeImageFilter,
113 
114  void 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 GetFactor() const
124  {
125  return this->GetFunctor().GetFactor();
126  }
127 
128 #ifdef ITK_USE_CONCEPT_CHECKING
129  // Begin concept checking
130  itkConceptMacro( InputConvertibleToDoubleCheck,
132  itkConceptMacro( DoubleConvertibleToOutputCheck,
134  // End concept checking
135 #endif
136 
137 protected:
139  virtual ~ExpNegativeImageFilter() ITK_OVERRIDE {}
140 
141 private:
142  ITK_DISALLOW_COPY_AND_ASSIGN(ExpNegativeImageFilter);
143 };
144 } // end namespace itk
145 
146 #endif
bool operator!=(const ExpNegative &other) const
SmartPointer< const Self > ConstPointer
Base class for all process objects that output image data.
bool operator==(const ExpNegative &other) const
Computes the function exp(-K.x) for each input pixel.
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition: itkMath.h:721
virtual void Modified() const
Implements pixel-wise generic operation on one image.
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::ExpNegative< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
TOutput operator()(const TInput &A) const
#define itkConceptMacro(name, concept)