ITK  4.9.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 http://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>
52  public InterpolateImageFunction<TInputImage, TCoordRep>
53 {
54 public:
60 
63 
65  itkNewMacro( Self );
66 
68  itkStaticConstMacro( ImageDimension, unsigned int,
69  TInputImage::ImageDimension );
70 
71 
74 
77 
79  typedef typename Superclass::RealType RealType;
80 
82  typedef typename Superclass::IndexType IndexType;
83 
86 
89 
93  virtual void SetInputImage( const TInputImage *image ) ITK_OVERRIDE
94  {
96  this->ComputeBoundingBox();
97  }
99 
103  virtual void SetSigma( const ArrayType s )
104  {
105  itkDebugMacro( "setting Sigma to " << s );
106  if( this->m_Sigma != s )
107  {
108  this->m_Sigma = s;
109  this->ComputeBoundingBox();
110  this->Modified();
111  }
112  }
113  virtual void SetSigma( RealType *s )
114  {
115  ArrayType sigma;
116  for( unsigned int d = 0; d < ImageDimension; d++ )
117  {
118  sigma[d] = s[d];
119  }
120  this->SetSigma( sigma );
121  }
122  itkGetConstMacro( Sigma, ArrayType );
124 
128  virtual void SetAlpha( const RealType a )
129  {
130  itkDebugMacro( "setting Alpha to " << a );
131  if( Math::NotExactlyEquals(this->m_Alpha, a) )
132  {
133  this->m_Alpha = a;
134  this->ComputeBoundingBox();
135  this->Modified();
136  }
137  }
138  itkGetConstMacro( Alpha, RealType );
140 
144  virtual void SetParameters( RealType *sigma, RealType alpha )
145  {
146  this->SetSigma( sigma );
147  this->SetAlpha( alpha );
148  }
150 
155  const ContinuousIndexType & cindex ) const ITK_OVERRIDE
156  {
157  return this->EvaluateAtContinuousIndex( cindex, ITK_NULLPTR );
158  }
159 
160 protected:
163  void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;
164 
165  virtual void ComputeBoundingBox();
166 
167  virtual void ComputeErrorFunctionArray( unsigned int dimension, RealType cindex,
168  vnl_vector<RealType> &erfArray, vnl_vector<RealType> &gerfArray,
169  bool evaluateGradient = false ) const;
170 
173 
178 
179 private:
180  GaussianInterpolateImageFunction( const Self& ) ITK_DELETE_FUNCTION;
181  void operator=( const Self& ) ITK_DELETE_FUNCTION;
182 
187  const ContinuousIndexType &, OutputType * ) const;
188 };
189 
190 } // end namespace itk
191 
192 #ifndef ITK_MANUAL_INSTANTIATION
193 #include "itkGaussianInterpolateImageFunction.hxx"
194 #include "itkMath.h"
195 #endif
196 
197 #endif
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
virtual void ComputeErrorFunctionArray(unsigned int dimension, RealType cindex, vnl_vector< RealType > &erfArray, vnl_vector< RealType > &gerfArray, bool evaluateGradient=false) const
Superclass::InputImageType InputImageType
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition: itkMath.h:676
virtual void Modified() const
Superclass::ContinuousIndexType ContinuousIndexType
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
void PrintSelf(std::ostream &os, Indent indent) const override
FixedArray< RealType, ImageDimension > ArrayType
NumericTraits< typename TInputImage::PixelType >::RealType RealType