ITK  4.12.0
Insight Segmentation and Registration Toolkit
itkGaussianInterpolateImageFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkGaussianInterpolateImageFunction.h,v $
5  Language: C++
6  Date: $Date: $
7  Version: $Revision: $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or https://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef itkGaussianInterpolateImageFunction_h
18 #define itkGaussianInterpolateImageFunction_h
19 
21 
22 #include "itkConceptChecking.h"
23 #include "itkFixedArray.h"
24 #include "vnl/vnl_erf.h"
25 
26 namespace itk
27 {
28 
50 template <typename TInputImage, typename TCoordRep = double>
51 class ITK_TEMPLATE_EXPORT GaussianInterpolateImageFunction :
52  public InterpolateImageFunction<TInputImage, TCoordRep>
53 {
54 public:
60 
63 
65  itkNewMacro( Self );
66 
68  itkStaticConstMacro( ImageDimension, unsigned int,
69  TInputImage::ImageDimension );
70 
71 
73  typedef typename Superclass::OutputType OutputType;
74 
76  typedef typename Superclass::InputImageType InputImageType;
77 
79  typedef typename Superclass::RealType RealType;
80 
82  typedef typename Superclass::IndexType IndexType;
83 
85  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
86 
89 
91  virtual void SetInputImage( const TInputImage *image ) ITK_OVERRIDE
92  {
93  Superclass::SetInputImage( image );
94  this->ComputeBoundingBox();
95  }
97 
99  virtual void SetSigma( const ArrayType s )
100  {
101  if( this->m_Sigma != s )
102  {
103  this->m_Sigma = s;
104  this->ComputeBoundingBox();
105  this->Modified();
106  }
107  }
108  virtual void SetSigma( RealType *s )
109  {
110  ArrayType sigma;
111  for( unsigned int d = 0; d < ImageDimension; d++ )
112  {
113  sigma[d] = s[d];
114  }
115  this->SetSigma( sigma );
116  }
117  itkGetConstMacro( Sigma, ArrayType );
119 
121  virtual void SetAlpha( const RealType a )
122  {
123  if( Math::NotExactlyEquals(this->m_Alpha, a) )
124  {
125  this->m_Alpha = a;
126  this->ComputeBoundingBox();
127  this->Modified();
128  }
129  }
130  itkGetConstMacro( Alpha, RealType );
132 
134  virtual void SetParameters( RealType *sigma, RealType alpha )
135  {
136  this->SetSigma( sigma );
137  this->SetAlpha( alpha );
138  }
140 
143  const ContinuousIndexType & cindex ) const ITK_OVERRIDE
144  {
145  return this->EvaluateAtContinuousIndex( cindex, ITK_NULLPTR );
146  }
147 
148 protected:
151  void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;
152 
153  virtual void ComputeBoundingBox();
154 
155  virtual void ComputeErrorFunctionArray( unsigned int dimension, RealType cindex,
156  vnl_vector<RealType> &erfArray, vnl_vector<RealType> &gerfArray,
157  bool evaluateGradient = false ) const;
158 
160  itkSetMacro( BoundingBoxStart, ArrayType );
161  itkGetConstMacro( BoundingBoxStart, ArrayType );
163 
165  itkSetMacro( BoundingBoxEnd, ArrayType );
166  itkGetConstMacro( BoundingBoxEnd, ArrayType );
168 
170  itkSetMacro( CutOffDistance, ArrayType );
171  itkGetConstMacro( CutOffDistance, ArrayType );
173 
174 
175 private:
176  ITK_DISALLOW_COPY_AND_ASSIGN(GaussianInterpolateImageFunction);
177 
179  virtual OutputType EvaluateAtContinuousIndex(
180  const ContinuousIndexType &, OutputType * ) const;
181 
184 
189 
190 
191 };
192 
193 } // end namespace itk
194 
195 #ifndef ITK_MANUAL_INSTANTIATION
196 #include "itkGaussianInterpolateImageFunction.hxx"
197 #include "itkMath.h"
198 #endif
199 
200 #endif
virtual void PrintSelf(std::ostream &os, Indent indent) const override
Light weight base class for most itk classes.
Evaluates the Gaussian interpolation of an image.
virtual void SetParameters(RealType *sigma, RealType alpha)
virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition: itkMath.h:721
Base class for all image interpolaters.
virtual void SetInputImage(const TInputImage *image) override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
InterpolateImageFunction< TInputImage, TCoordRep > Superclass
FixedArray< RealType, ImageDimension > ArrayType
NumericTraits< typename TInputImage::PixelType >::RealType RealType