ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkGaussianInterpolateImageFunction.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 
19 #ifndef itkGaussianInterpolateImageFunction_h
20 #define itkGaussianInterpolateImageFunction_h
21 
23 
24 #include "itkConceptChecking.h"
25 #include "itkFixedArray.h"
26 #include "vnl/vnl_erf.h"
27 
28 namespace itk
29 {
30 
52 template <typename TInputImage, typename TCoordRep = double>
53 class ITK_TEMPLATE_EXPORT GaussianInterpolateImageFunction :
54  public InterpolateImageFunction<TInputImage, TCoordRep>
55 {
56 public:
62 
65 
67  itkNewMacro( Self );
68 
70  itkStaticConstMacro( ImageDimension, unsigned int,
71  TInputImage::ImageDimension );
72 
73 
75  typedef typename Superclass::OutputType OutputType;
76 
78  typedef typename Superclass::InputImageType InputImageType;
79 
81  typedef typename Superclass::RealType RealType;
82 
84  typedef typename Superclass::IndexType IndexType;
85 
87  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
88 
91 
93  virtual void SetInputImage( const TInputImage *image ) ITK_OVERRIDE
94  {
95  Superclass::SetInputImage( image );
96  this->ComputeBoundingBox();
97  }
99 
101  virtual void SetSigma( const ArrayType s )
102  {
103  if( this->m_Sigma != s )
104  {
105  this->m_Sigma = s;
106  this->ComputeBoundingBox();
107  this->Modified();
108  }
109  }
110  virtual void SetSigma( RealType *s )
111  {
112  ArrayType sigma;
113  for( unsigned int d = 0; d < ImageDimension; d++ )
114  {
115  sigma[d] = s[d];
116  }
117  this->SetSigma( sigma );
118  }
119  itkGetConstMacro( Sigma, ArrayType );
121 
123  virtual void SetAlpha( const RealType a )
124  {
125  if( Math::NotExactlyEquals(this->m_Alpha, a) )
126  {
127  this->m_Alpha = a;
128  this->ComputeBoundingBox();
129  this->Modified();
130  }
131  }
132  itkGetConstMacro( Alpha, RealType );
134 
136  virtual void SetParameters( RealType *sigma, RealType alpha )
137  {
138  this->SetSigma( sigma );
139  this->SetAlpha( alpha );
140  }
142 
145  const ContinuousIndexType & cindex ) const ITK_OVERRIDE
146  {
147  return this->EvaluateAtContinuousIndex( cindex, ITK_NULLPTR );
148  }
149 
150 protected:
153  void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;
154 
155  virtual void ComputeBoundingBox();
156 
157  virtual void ComputeErrorFunctionArray( unsigned int dimension, RealType cindex,
158  vnl_vector<RealType> &erfArray, vnl_vector<RealType> &gerfArray,
159  bool evaluateGradient = false ) const;
160 
162  itkSetMacro( BoundingBoxStart, ArrayType );
163  itkGetConstMacro( BoundingBoxStart, ArrayType );
165 
167  itkSetMacro( BoundingBoxEnd, ArrayType );
168  itkGetConstMacro( BoundingBoxEnd, ArrayType );
170 
172  itkSetMacro( CutOffDistance, ArrayType );
173  itkGetConstMacro( CutOffDistance, ArrayType );
175 
176 
177 private:
178  ITK_DISALLOW_COPY_AND_ASSIGN(GaussianInterpolateImageFunction);
179 
181  virtual OutputType EvaluateAtContinuousIndex(
182  const ContinuousIndexType &, OutputType * ) const;
183 
186 
191 
192 
193 };
194 
195 } // end namespace itk
196 
197 #ifndef ITK_MANUAL_INSTANTIATION
198 #include "itkGaussianInterpolateImageFunction.hxx"
199 #include "itkMath.h"
200 #endif
201 
202 #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
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