ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkPhysicalCentralDifferenceImageFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkPhysicalCentralDifferenceImageFunction.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 itkPhysicalCentralDifferenceImageFunction_h
18 #define itkPhysicalCentralDifferenceImageFunction_h
19 
20 #include "itkImageFunction.h"
21 #include "itkCovariantVector.h"
22 #include "itkImageBase.h"
24 
25 namespace itk
26 {
27 
41 template <
42  class TInputImage,
43  class TCoordRep = float >
45  public ImageFunction< TInputImage,
46  CovariantVector<double, TInputImage::ImageDimension>,
47  TCoordRep >
48 {
49 public:
50 
52  itkStaticConstMacro(ImageDimension, unsigned int,
53  TInputImage::ImageDimension);
54 
57  typedef ImageFunction<TInputImage,
58  CovariantVector<double,
59  itkGetStaticConstMacro(ImageDimension)>,
60  TCoordRep> Superclass;
63 
66 
68  itkNewMacro(Self);
69 
71  typedef TInputImage InputImageType;
72 
74  typedef typename Superclass::OutputType OutputType;
75 
77  typedef typename Superclass::IndexType IndexType;
78 
80  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
81 
83  typedef typename Superclass::PointType PointType;
84 
88 
93  virtual void SetInputImage( const InputImageType * ptr ) ITK_OVERRIDE
94  {
95  this->Superclass::SetInputImage( ptr );
96  if ( m_Interpolator.IsNotNull() )
97  {
98  m_Interpolator->SetInputImage( ptr );
99  }
100  }
102 
108  virtual OutputType EvaluateAtIndex( const IndexType& index ) const ITK_OVERRIDE
109  {
110  PointType point;
111  m_Interpolator->GetInputImage()->TransformIndexToPhysicalPoint( index, point );
112  return this->Evaluate( point );
113  }
115 
123  const ContinuousIndexType& cindex ) const ITK_OVERRIDE
124  {
125  PointType point;
126  m_Interpolator->GetInputImage()->TransformContinuousIndexToPhysicalPoint( cindex, point );
127  return this->Evaluate( point );
128  }
130 
137  virtual OutputType Evaluate( const PointType& point ) const ITK_OVERRIDE;
138 
139 protected:
142  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
143 
144 private:
145  ITK_DISALLOW_COPY_AND_ASSIGN(PhysicalCentralDifferenceImageFunction);
146 
148 
149 };
150 
151 } // end namespace itk
152 
153 #ifndef ITK_MANUAL_INSTANTIATION
154 # include "itkPhysicalCentralDifferenceImageFunction.hxx"
155 #endif
156 
157 #endif
Light weight base class for most itk classes.
ImageFunction< TInputImage, CovariantVector< double, itkGetStaticConstMacro(ImageDimension)>, TCoordRep > Superclass
virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
virtual OutputType EvaluateAtIndex(const IndexType &index) const override
Calculate the derivative by central differencing in physical space.
virtual void SetInputImage(const InputImageType *ptr) override
Linearly interpolate an image at specified positions.
LinearInterpolateImageFunction< TInputImage, TCoordRep > InterpolateImageFunctionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
A templated class holding a n-Dimensional covariant vector.
Evaluates a function of an image at specified position.