ITK  4.8.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 "vnl/vnl_math.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; }
40 
41  bool operator!=(const ExpNegative & other) const
42  {
43  if ( m_Factor != other.m_Factor )
44  {
45  return true;
46  }
47  return false;
48  }
49 
50  bool operator==(const ExpNegative & other) const
51  {
52  return !( *this != other );
53  }
54 
55  inline TOutput operator()(const TInput & A) const
56  {
57  return static_cast< TOutput >( std::exp( -m_Factor * static_cast< double >( A ) ) );
58  }
59 
61  void SetFactor(double factor)
62  {
63  m_Factor = factor;
64  }
65 
66  double GetFactor() const
67  {
68  return m_Factor;
69  }
70 
71 private:
72  double m_Factor;
73 };
74 }
87 template< typename TInputImage, typename TOutputImage >
89  public
90  UnaryFunctorImageFilter< TInputImage, TOutputImage,
91  Functor::ExpNegative<
92  typename TInputImage::PixelType,
93  typename TOutputImage::PixelType > >
94 {
95 public:
99  TInputImage, TOutputImage,
100  Functor::ExpNegative< typename TInputImage::PixelType,
101  typename TOutputImage::PixelType > > Superclass;
102 
105 
107  itkNewMacro(Self);
108 
110  itkTypeMacro(ExpNegativeImageFilter,
112 
113  void SetFactor(double factor)
114  {
115  if ( factor == this->GetFunctor().GetFactor() )
116  {
117  return;
118  }
119  this->GetFunctor().SetFactor(factor);
120  this->Modified();
121  }
122  double GetFactor() const
123  {
124  return this->GetFunctor().GetFactor();
125  }
126 
127 #ifdef ITK_USE_CONCEPT_CHECKING
128  // Begin concept checking
129  itkConceptMacro( InputConvertibleToDoubleCheck,
131  itkConceptMacro( DoubleConvertibleToOutputCheck,
133  // End concept checking
134 #endif
135 
136 protected:
139 
140 private:
141  ExpNegativeImageFilter(const Self &); //purposely not implemented
142  void operator=(const Self &); //purposely not implemented
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.
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)
void operator=(const Self &)