18 #ifndef itkNearestNeighborExtrapolateImageFunction_h
19 #define itkNearestNeighborExtrapolateImageFunction_h
41 template <
typename TInputImage,
typename TCoordinate =
float>
61 using typename Superclass::OutputType;
64 using typename Superclass::InputImageType;
67 static constexpr
unsigned int ImageDimension = Superclass::ImageDimension;
74 using typename Superclass::ContinuousIndexType;
88 const IndexType startIndex = this->GetStartIndex();
89 const IndexType endIndex = this->GetEndIndex();
91 for (
unsigned int j = 0; j < ImageDimension; ++j)
93 nindex[j] = std::clamp(Math::RoundHalfIntegerUp<IndexValueType>(index[j]), startIndex[j], endIndex[j]);
95 return static_cast<OutputType>(this->GetInputImage()->GetPixel(nindex));
110 const IndexType startIndex = this->GetStartIndex();
111 const IndexType endIndex = this->GetEndIndex();
113 for (
unsigned int j = 0; j < ImageDimension; ++j)
115 nindex[j] = std::clamp(index[j], startIndex[j], endIndex[j]);
117 return static_cast<OutputType>(this->GetInputImage()->GetPixel(nindex));
126 Superclass::PrintSelf(os, indent);