ITK  6.0.0
Insight Toolkit
itkVectorInterpolateImageFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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 itkVectorInterpolateImageFunction_h
19 #define itkVectorInterpolateImageFunction_h
20 
21 #include "itkImageFunction.h"
22 #include "itkFixedArray.h"
23 
24 namespace itk
25 {
26 
46 template <typename TInputImage, typename TCoordRep = double>
47 class ITK_TEMPLATE_EXPORT VectorInterpolateImageFunction
48  : public ImageFunction<TInputImage, typename NumericTraits<typename TInputImage::PixelType>::RealType, TCoordRep>
49 {
50 public:
51  ITK_DISALLOW_COPY_AND_MOVE(VectorInterpolateImageFunction);
52 
54  static constexpr unsigned int Dimension = TInputImage::PixelType::Dimension;
55 
57  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
58 
61  using Superclass =
63 
66 
68  itkOverrideGetNameOfClassMacro(VectorInterpolateImageFunction);
69 
71  using typename Superclass::InputImageType;
72  using PixelType = typename InputImageType::PixelType;
73  using ValueType = typename PixelType::ValueType;
75 
77  using typename Superclass::PointType;
78 
80  using typename Superclass::IndexType;
81 
83  using typename Superclass::ContinuousIndexType;
84 
86  using typename Superclass::OutputType;
87 
89  using CoordRepType = TCoordRep;
90 
97  Evaluate(const PointType & point) const override
98  {
99  const ContinuousIndexType index =
100  this->GetInputImage()->template TransformPhysicalPointToContinuousIndex<TCoordRep>(point);
101  return (this->EvaluateAtContinuousIndex(index));
102  }
115  OutputType
116  EvaluateAtContinuousIndex(const ContinuousIndexType & index) const override = 0;
117 
125  OutputType
126  EvaluateAtIndex(const IndexType & index) const override
127  {
128  OutputType output;
129  PixelType input = this->GetInputImage()->GetPixel(index);
132  for (unsigned int k = 0; k < this->GetInputImage()->GetNumberOfComponentsPerPixel(); ++k)
133  {
134  output[k] = static_cast<double>(input[k]);
135  }
136  return (output);
137  }
138 
139 protected:
140  VectorInterpolateImageFunction() = default;
141  ~VectorInterpolateImageFunction() override = default;
142 };
143 } // end namespace itk
144 
145 #endif
itkImageFunction.h
itk::ImageFunction< TInputImage, NumericTraits< TInputImage::PixelType >::RealType, TCoordRep >::IndexType
typename InputImageType::IndexType IndexType
Definition: itkImageFunction.h:90
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::VectorInterpolateImageFunction::Evaluate
OutputType Evaluate(const PointType &point) const override
Definition: itkVectorInterpolateImageFunction.h:97
itk::SmartPointer< Self >
itk::VectorInterpolateImageFunction
Base class for all vector image interpolators.
Definition: itkVectorInterpolateImageFunction.h:47
itk::FunctionBase< Point< TCoordRep, TInputImage::ImageDimension >, NumericTraits< TInputImage::PixelType >::RealType >::OutputType
NumericTraits< TInputImage::PixelType >::RealType OutputType
Definition: itkFunctionBase.h:62
itk::VectorInterpolateImageFunction::PixelType
typename InputImageType::PixelType PixelType
Definition: itkVectorInterpolateImageFunction.h:72
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageFunction
Evaluates a function of an image at specified position.
Definition: itkImageFunction.h:55
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::point
*par Constraints *The filter requires an image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents
itkFixedArray.h
itk::VectorInterpolateImageFunction::RealType
typename NumericTraits< ValueType >::RealType RealType
Definition: itkVectorInterpolateImageFunction.h:74
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ContinuousIndex< TCoordRep, Self::ImageDimension >
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53
itk::VectorInterpolateImageFunction::CoordRepType
TCoordRep CoordRepType
Definition: itkVectorInterpolateImageFunction.h:89
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:86
itk::VectorInterpolateImageFunction::ValueType
typename PixelType::ValueType ValueType
Definition: itkVectorInterpolateImageFunction.h:73
itk::VectorInterpolateImageFunction::EvaluateAtIndex
OutputType EvaluateAtIndex(const IndexType &index) const override
Definition: itkVectorInterpolateImageFunction.h:126
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44