ITK  4.2.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 <class TInputImage, class 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 
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 
93  virtual void SetInputImage( const TInputImage *image )
94  {
95  Superclass::SetInputImage( image );
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( 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 
154  virtual OutputType EvaluateAtContinuousIndex(
155  const ContinuousIndexType & cindex ) const
156  {
157  return this->EvaluateAtContinuousIndex( cindex, NULL );
158  }
159 
160 protected:
163  void PrintSelf( std::ostream& os, Indent indent ) const;
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& ); //purposely not implemented
181  void operator=( const Self& ); //purposely not implemented
182 
186  virtual OutputType EvaluateAtContinuousIndex(
187  const ContinuousIndexType &, OutputType * ) const;
188 };
189 
190 } // end namespace itk
191 
192 #ifndef ITK_MANUAL_INSTANTIATION
193 #include "itkGaussianInterpolateImageFunction.hxx"
194 #endif
195 
196 #endif
197