ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkInterpolateImageFunction.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 #ifndef itkInterpolateImageFunction_h
19 #define itkInterpolateImageFunction_h
20 
21 #include "itkImageFunction.h"
22 
23 namespace itk
24 {
43 template< typename TInputImage, typename TCoordRep = double >
44 class ITK_TEMPLATE_EXPORT InterpolateImageFunction:
45  public ImageFunction< TInputImage,
46  typename NumericTraits< typename TInputImage::PixelType >::RealType, TCoordRep >
47 {
48 public:
49  ITK_DISALLOW_COPY_AND_ASSIGN(InterpolateImageFunction);
50 
53  using Superclass = ImageFunction< TInputImage,
55  TCoordRep >;
56 
59 
62 
64  using OutputType = typename Superclass::OutputType;
65 
67  using InputImageType = typename Superclass::InputImageType;
68 
70  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
71 
73  using PointType = typename Superclass::PointType;
74 
76  using IndexType = typename Superclass::IndexType;
78 
80  using ContinuousIndexType = typename Superclass::ContinuousIndexType;
81 
84 
93  OutputType Evaluate(const PointType & point) const override
94  {
95  ContinuousIndexType index;
96 
97  this->GetInputImage()->TransformPhysicalPointToContinuousIndex(point, index);
98  return ( this->EvaluateAtContinuousIndex(index) );
99  }
100 
111  OutputType EvaluateAtContinuousIndex(
112  const ContinuousIndexType & index) const override = 0;
113 
122  OutputType EvaluateAtIndex(const IndexType & index) const override
123  {
124  return ( static_cast< RealType >( this->GetInputImage()->GetPixel(index) ) );
125  }
126 
127 protected:
128  InterpolateImageFunction()= default;
129  ~InterpolateImageFunction() override = default;
130  void PrintSelf(std::ostream & os, Indent indent) const override
131  { Superclass::PrintSelf(os, indent); }
132 };
133 } // end namespace itk
134 
135 #endif
Light weight base class for most itk classes.
Define numeric traits for std::vector.
typename NumericTraits< typename TImageType::PixelType >::RealType RealType
OutputType Evaluate(const PointType &point) const override
signed long IndexValueType
Definition: itkIntTypes.h:90
Base class for all image interpolaters.
void PrintSelf(std::ostream &os, Indent indent) const override
OutputType EvaluateAtIndex(const IndexType &index) const override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
Evaluates a function of an image at specified position.