ITK  6.0.0
Insight Toolkit
itkVectorNearestNeighborInterpolateImageFunction.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 itkVectorNearestNeighborInterpolateImageFunction_h
19 #define itkVectorNearestNeighborInterpolateImageFunction_h
20 
22 
23 namespace itk
24 {
42 template <typename TInputImage, typename TCoordRep = double>
44  : public VectorInterpolateImageFunction<TInputImage, TCoordRep>
45 {
46 public:
47  ITK_DISALLOW_COPY_AND_MOVE(VectorNearestNeighborInterpolateImageFunction);
48 
54 
56  itkNewMacro(Self);
57 
59  itkOverrideGetNameOfClassMacro(VectorNearestNeighborInterpolateImageFunction);
60 
62  using typename Superclass::InputImageType;
63  using typename Superclass::PixelType;
64  using typename Superclass::ValueType;
65  using typename Superclass::RealType;
66 
68  static constexpr unsigned int Dimension = Superclass::Dimension;
69 
71  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
72 
74  using typename Superclass::IndexType;
75 
77  using typename Superclass::ContinuousIndexType;
78 
80  using typename Superclass::OutputType;
81 
91  EvaluateAtContinuousIndex(const ContinuousIndexType & index) const override
92  {
93  IndexType nindex;
94 
95  this->ConvertContinuousIndexToNearestIndex(index, nindex);
96  return static_cast<OutputType>(this->GetInputImage()->GetPixel(nindex));
97  }
98 
99 protected:
101  ~VectorNearestNeighborInterpolateImageFunction() override = default;
102 };
103 } // end namespace itk
104 
105 #endif
itk::ImageFunction< TInputImage, NumericTraits< TInputImage::PixelType >::RealType, TCoordRep >::IndexType
typename InputImageType::IndexType IndexType
Definition: itkImageFunction.h:90
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::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::VectorNearestNeighborInterpolateImageFunction::EvaluateAtContinuousIndex
OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &index) const override
Definition: itkVectorNearestNeighborInterpolateImageFunction.h:91
itkVectorInterpolateImageFunction.h
itk::VectorNearestNeighborInterpolateImageFunction
Nearest neighbor interpolate a vector image at specified positions.
Definition: itkVectorNearestNeighborInterpolateImageFunction.h:43
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ContinuousIndex< TCoordRep, Self::ImageDimension >
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44