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 TCoordinate = double>
47 class ITK_TEMPLATE_EXPORT VectorInterpolateImageFunction
48  : public ImageFunction<TInputImage, typename NumericTraits<typename TInputImage::PixelType>::RealType, TCoordinate>
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 CoordinateType = TCoordinate;
90 #ifndef ITK_FUTURE_LEGACY_REMOVE
91  using CoordRepType ITK_FUTURE_DEPRECATED(
92  "ITK 6 discourages using `CoordRepType`. Please use `CoordinateType` instead!") = CoordinateType;
93 #endif
94 
100  OutputType
101  Evaluate(const PointType & point) const override
102  {
103  const ContinuousIndexType index =
104  this->GetInputImage()->template TransformPhysicalPointToContinuousIndex<TCoordinate>(point);
105  return (this->EvaluateAtContinuousIndex(index));
106  }
119  OutputType
120  EvaluateAtContinuousIndex(const ContinuousIndexType & index) const override = 0;
121 
129  OutputType
130  EvaluateAtIndex(const IndexType & index) const override
131  {
132  OutputType output;
133  PixelType input = this->GetInputImage()->GetPixel(index);
136  for (unsigned int k = 0; k < this->GetInputImage()->GetNumberOfComponentsPerPixel(); ++k)
137  {
138  output[k] = static_cast<double>(input[k]);
139  }
140  return (output);
141  }
142 
143 protected:
144  VectorInterpolateImageFunction() = default;
145  ~VectorInterpolateImageFunction() override = default;
146 };
147 } // end namespace itk
148 
149 #endif
itk::VectorInterpolateImageFunction::ValueType
typename PixelType::ValueType ValueType
Definition: itkVectorInterpolateImageFunction.h:73
itkImageFunction.h
itk::VectorInterpolateImageFunction::RealType
typename NumericTraits< ValueType >::RealType RealType
Definition: itkVectorInterpolateImageFunction.h:74
itk::VectorInterpolateImageFunction::PixelType
typename InputImageType::PixelType PixelType
Definition: itkVectorInterpolateImageFunction.h:72
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::SmartPointer< Self >
itk::VectorInterpolateImageFunction
Base class for all vector image interpolators.
Definition: itkVectorInterpolateImageFunction.h:47
itk::FunctionBase< Point< TCoordinate, TInputImage::ImageDimension >, NumericTraits< TInputImage::PixelType >::RealType >::OutputType
NumericTraits< TInputImage::PixelType >::RealType OutputType
Definition: itkFunctionBase.h:62
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::VectorInterpolateImageFunction::EvaluateAtIndex
OutputType EvaluateAtIndex(const IndexType &index) const override
Definition: itkVectorInterpolateImageFunction.h:130
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
itk::VectorInterpolateImageFunction::Evaluate
OutputType Evaluate(const PointType &point) const override
Definition: itkVectorInterpolateImageFunction.h:101
itkFixedArray.h
itk::VectorInterpolateImageFunction::CoordinateType
TCoordinate CoordinateType
Definition: itkVectorInterpolateImageFunction.h:89
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ContinuousIndex< TCoordinate, Self::ImageDimension >
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:86
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::ImageFunction< TInputImage, NumericTraits< TInputImage::PixelType >::RealType, TCoordinate >::IndexType
typename InputImageType::IndexType IndexType
Definition: itkImageFunction.h:94