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
24namespace itk
25{
26
46template <typename TInputImage, typename TCoordinate = double>
47class ITK_TEMPLATE_EXPORT VectorInterpolateImageFunction
48 : public ImageFunction<TInputImage, typename NumericTraits<typename TInputImage::PixelType>::RealType, TCoordinate>
49{
50public:
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
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
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
143protected:
146};
147} // end namespace itk
148
149#endif
Evaluates a function of an image at specified position.
Light weight base class for most itk classes.
Base class for all vector image interpolators.
OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &index) const override=0
OutputType EvaluateAtIndex(const IndexType &index) const override
typename NumericTraits< ValueType >::RealType RealType
typename InputImageType::PixelType PixelType
OutputType Evaluate(const PointType &point) const override
~VectorInterpolateImageFunction() override=default
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
*par Constraints *The filter 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