ITK  6.0.0
Insight Toolkit
itkNearestNeighborInterpolateImageFunction.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 itkNearestNeighborInterpolateImageFunction_h
19#define itkNearestNeighborInterpolateImageFunction_h
20
22
23namespace itk
24{
38template <typename TInputImage, typename TCoordRep = double>
40 : public InterpolateImageFunction<TInputImage, TCoordRep>
41{
42public:
43 ITK_DISALLOW_COPY_AND_MOVE(NearestNeighborInterpolateImageFunction);
44
50
52 itkOverrideGetNameOfClassMacro(NearestNeighborInterpolateImageFunction);
53
55 itkNewMacro(Self);
56
58 using typename Superclass::OutputType;
59
61 using typename Superclass::InputImageType;
62
64 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
65
67 using typename Superclass::IndexType;
68
70 using typename Superclass::SizeType;
71
73 using typename Superclass::ContinuousIndexType;
74
84 EvaluateAtContinuousIndex(const ContinuousIndexType & index) const override
85 {
86 IndexType nindex;
87
88 this->ConvertContinuousIndexToNearestIndex(index, nindex);
89 return static_cast<OutputType>(this->GetInputImage()->GetPixel(nindex));
90 }
91
93 GetRadius() const override
94 {
95 return SizeType(); // zeroes by default
96 }
97
98protected:
101 void
102 PrintSelf(std::ostream & os, Indent indent) const override
103 {
104 Superclass::PrintSelf(os, indent);
105 }
106};
107} // end namespace itk
108
109#endif
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for all image interpolators.
Light weight base class for most itk classes.
Nearest neighbor interpolation of a scalar image.
~NearestNeighborInterpolateImageFunction() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &index) const override
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....