ITK  5.0.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  ITK_DISALLOW_COPY_AND_ASSIGN(PhysicalCentralDifferenceImageFunction);
51 
53  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
54 
57  using Superclass = ImageFunction<TInputImage,
58  CovariantVector<double,
59  itkGetStaticConstMacro(ImageDimension)>,
60  TCoordRep>;
63 
66 
68  itkNewMacro(Self);
69 
71  using InputImageType = TInputImage;
72 
74  using OutputType = typename Superclass::OutputType;
75 
77  using IndexType = typename Superclass::IndexType;
78 
80  using ContinuousIndexType = typename Superclass::ContinuousIndexType;
81 
83  using PointType = typename Superclass::PointType;
84 
87 
92  void SetInputImage( const InputImageType * ptr ) override
93  {
94  this->Superclass::SetInputImage( ptr );
95  if ( m_Interpolator.IsNotNull() )
96  {
97  m_Interpolator->SetInputImage( ptr );
98  }
99  }
101 
107  OutputType EvaluateAtIndex( const IndexType& index ) const override
108  {
109  PointType point;
110  m_Interpolator->GetInputImage()->TransformIndexToPhysicalPoint( index, point );
111  return this->Evaluate( point );
112  }
114 
122  const ContinuousIndexType& cindex ) const override
123  {
124  PointType point;
125  m_Interpolator->GetInputImage()->TransformContinuousIndexToPhysicalPoint( cindex, point );
126  return this->Evaluate( point );
127  }
129 
136  OutputType Evaluate( const PointType& point ) const override;
137 
138 protected:
141  void PrintSelf(std::ostream& os, Indent indent) const override;
142 
143 private:
145 
146 };
147 
148 } // end namespace itk
149 
150 #ifndef ITK_MANUAL_INSTANTIATION
151 # include "itkPhysicalCentralDifferenceImageFunction.hxx"
152 #endif
153 
154 #endif
Light weight base class for most itk classes.
OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
OutputType EvaluateAtIndex(const IndexType &index) const override
Calculate the derivative by central differencing in physical space.
Linearly interpolate an image at specified positions.
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.