28 #ifndef itkBSplineInterpolateImageFunction_h
29 #define itkBSplineInterpolateImageFunction_h
32 #include "vnl/vnl_matrix.h"
82 template <
typename TImageType,
typename TCoordinate =
double,
typename TCoefficientType =
double>
101 using typename Superclass::OutputType;
104 using typename Superclass::InputImageType;
107 static constexpr
unsigned int ImageDimension = Superclass::ImageDimension;
116 using typename Superclass::ContinuousIndexType;
147 this->GetInputImage()->template TransformPhysicalPointToContinuousIndex<TCoordinate>(
point);
149 return (this->EvaluateAtContinuousIndex(index));
157 this->GetInputImage()->template TransformPhysicalPointToContinuousIndex<TCoordinate>(
point);
158 return (this->EvaluateAtContinuousIndex(index, threadId));
166 vnl_matrix<long> evaluateIndex(ImageDimension, (m_SplineOrder + 1));
167 vnl_matrix<double> weights(ImageDimension, (m_SplineOrder + 1));
171 return this->EvaluateAtContinuousIndexInternal(index, evaluateIndex, weights);
178 return this->EvaluateAtContinuousIndexInternal(x, m_ThreadedEvaluateIndex[threadId], m_ThreadedWeights[threadId]);
185 this->GetInputImage()->template TransformPhysicalPointToContinuousIndex<TCoordinate>(
point);
188 return (this->EvaluateDerivativeAtContinuousIndex(index));
195 this->GetInputImage()->template TransformPhysicalPointToContinuousIndex<TCoordinate>(
point);
196 return (this->EvaluateDerivativeAtContinuousIndex(index, threadId));
206 vnl_matrix<long> evaluateIndex(ImageDimension, (m_SplineOrder + 1));
207 vnl_matrix<double> weights(ImageDimension, (m_SplineOrder + 1));
208 vnl_matrix<double> weightsDerivative(ImageDimension, (m_SplineOrder + 1));
213 return this->EvaluateDerivativeAtContinuousIndexInternal(x, evaluateIndex, weights, weightsDerivative);
219 return this->EvaluateDerivativeAtContinuousIndexInternal(
220 x, m_ThreadedEvaluateIndex[threadId], m_ThreadedWeights[threadId], m_ThreadedWeightsDerivative[threadId]);
227 this->GetInputImage()->template TransformPhysicalPointToContinuousIndex<TCoordinate>(
point);
230 this->EvaluateValueAndDerivativeAtContinuousIndex(index, value, deriv);
240 this->GetInputImage()->template TransformPhysicalPointToContinuousIndex<TCoordinate>(
point);
241 this->EvaluateValueAndDerivativeAtContinuousIndex(index, value, deriv, threadId);
253 vnl_matrix<long> evaluateIndex(ImageDimension, (m_SplineOrder + 1));
254 vnl_matrix<double> weights(ImageDimension, (m_SplineOrder + 1));
255 vnl_matrix<double> weightsDerivative(ImageDimension, (m_SplineOrder + 1));
260 this->EvaluateValueAndDerivativeAtContinuousIndexInternal(
261 x, value, deriv, evaluateIndex, weights, weightsDerivative);
270 this->EvaluateValueAndDerivativeAtContinuousIndexInternal(x,
273 m_ThreadedEvaluateIndex[threadId],
274 m_ThreadedWeights[threadId],
275 m_ThreadedWeightsDerivative[threadId]);
281 SetSplineOrder(
unsigned int SplineOrder);
283 itkGetConstMacro(SplineOrder,
unsigned int);
292 SetInputImage(
const TImageType * inputData)
override;
304 itkSetMacro(UseImageDirection,
bool);
305 itkGetConstMacro(UseImageDirection,
bool);
306 itkBooleanMacro(UseImageDirection);
312 return SizeType::Filled(m_SplineOrder + 1);
335 EvaluateAtContinuousIndexInternal(
const ContinuousIndexType & x,
336 vnl_matrix<long> & evaluateIndex,
337 vnl_matrix<double> & weights)
const;
340 EvaluateValueAndDerivativeAtContinuousIndexInternal(
const ContinuousIndexType & x,
342 CovariantVectorType & derivativeValue,
343 vnl_matrix<long> & evaluateIndex,
344 vnl_matrix<double> & weights,
345 vnl_matrix<double> & weightsDerivative)
const;
347 virtual CovariantVectorType
348 EvaluateDerivativeAtContinuousIndexInternal(
const ContinuousIndexType & x,
349 vnl_matrix<long> & evaluateIndex,
350 vnl_matrix<double> & weights,
351 vnl_matrix<double> & weightsDerivative)
const;
356 PrintSelf(std::ostream & os,
Indent indent)
const override;
360 std::vector<CoefficientDataType> m_Scratch{};
364 unsigned int m_SplineOrder{};
372 SetInterpolationWeights(
const ContinuousIndexType & x,
373 const vnl_matrix<long> & EvaluateIndex,
374 vnl_matrix<double> & weights,
375 unsigned int splineOrder)
const;
379 SetDerivativeWeights(
const ContinuousIndexType & x,
380 const vnl_matrix<long> & EvaluateIndex,
381 vnl_matrix<double> & weights,
382 unsigned int splineOrder)
const;
387 GeneratePointsToIndex();
391 DetermineRegionOfSupport(vnl_matrix<long> & evaluateIndex,
392 const ContinuousIndexType & x,
393 unsigned int splineOrder)
const;
398 ApplyMirrorBoundaryConditions(vnl_matrix<long> & evaluateIndex,
unsigned int splineOrder)
const;
403 unsigned long m_MaxNumberInterpolationPoints{};
407 std::vector<IndexType> m_PointsToIndex{};
416 bool m_UseImageDirection{
true };
425 #ifndef ITK_MANUAL_INSTANTIATION
426 # include "itkBSplineInterpolateImageFunction.hxx"