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 TCoordRep = double>
47class ITK_TEMPLATE_EXPORT VectorInterpolateImageFunction
48 : public ImageFunction<TInputImage, typename NumericTraits<typename TInputImage::PixelType>::RealType, TCoordRep>
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 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
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
139protected:
142};
143} // end namespace itk
144
145#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 Evaluate(const PointType &point) const override
OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &index) const override=0
OutputType EvaluateAtIndex(const IndexType &index) const override
typename NumericTraits< ValueType >::RealType RealType
typename InputImageType::PixelType PixelType
~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