28#ifndef itkBSplineInterpolateImageFunction_h
29#define itkBSplineInterpolateImageFunction_h
32#include "vnl/vnl_matrix.h"
82template <
typename TImageType,
typename TCoordRep =
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<TCoordRep>(
point);
149 return (this->EvaluateAtContinuousIndex(index));
157 this->GetInputImage()->template TransformPhysicalPointToContinuousIndex<TCoordRep>(
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<TCoordRep>(
point);
188 return (this->EvaluateDerivativeAtContinuousIndex(index));
195 this->GetInputImage()->template TransformPhysicalPointToContinuousIndex<TCoordRep>(
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<TCoordRep>(
point);
230 this->EvaluateValueAndDerivativeAtContinuousIndex(index, value, deriv);
240 this->GetInputImage()->template TransformPhysicalPointToContinuousIndex<TCoordRep>(
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]);
283 itkGetConstMacro(SplineOrder,
unsigned int);
304 itkSetMacro(UseImageDirection,
bool);
305 itkGetConstMacro(UseImageDirection,
bool);
306 itkBooleanMacro(UseImageDirection);
312 return SizeType::Filled(m_SplineOrder + 1);
336 vnl_matrix<long> & evaluateIndex,
337 vnl_matrix<double> & weights)
const;
343 vnl_matrix<long> & evaluateIndex,
344 vnl_matrix<double> & weights,
345 vnl_matrix<double> & weightsDerivative)
const;
349 vnl_matrix<long> & evaluateIndex,
350 vnl_matrix<double> & weights,
351 vnl_matrix<double> & weightsDerivative)
const;
360 std::vector<CoefficientDataType> m_Scratch{};
364 unsigned int m_SplineOrder{};
373 const vnl_matrix<long> & EvaluateIndex,
374 vnl_matrix<double> & weights,
375 unsigned int splineOrder)
const;
380 const vnl_matrix<long> & EvaluateIndex,
381 vnl_matrix<double> & weights,
382 unsigned int splineOrder)
const;
393 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"
Calculates the B-Spline coefficients of an image. Spline order may be from 0 to 5.
Evaluates the B-Spline interpolation of an image. Spline order may be from 0 to 5.
SizeType GetRadius() const override
CovariantVectorType EvaluateDerivativeAtContinuousIndex(const ContinuousIndexType &x, ThreadIdType threadId) const
void EvaluateValueAndDerivative(const PointType &point, OutputType &value, CovariantVectorType &deriv, ThreadIdType threadId) const
std::unique_ptr< vnl_matrix< double >[]> m_ThreadedWeights
OutputType Evaluate(const PointType &point) const override
void EvaluateValueAndDerivativeAtContinuousIndex(const ContinuousIndexType &x, OutputType &value, CovariantVectorType &derivativeValue, ThreadIdType threadId) const
void GeneratePointsToIndex()
void SetInterpolationWeights(const ContinuousIndexType &x, const vnl_matrix< long > &EvaluateIndex, vnl_matrix< double > &weights, unsigned int splineOrder) const
void EvaluateValueAndDerivative(const PointType &point, OutputType &value, CovariantVectorType &deriv) const
virtual OutputType Evaluate(const PointType &point, ThreadIdType threadId) const
void SetInputImage(const TImageType *inputData) override
void PrintSelf(std::ostream &os, Indent indent) const override
std::unique_ptr< vnl_matrix< double >[]> m_ThreadedWeightsDerivative
TCoefficientType CoefficientDataType
CovariantVectorType EvaluateDerivative(const PointType &point, ThreadIdType threadId) const
void SetSplineOrder(unsigned int SplineOrder)
void SetNumberOfWorkUnits(ThreadIdType numThreads)
void EvaluateValueAndDerivativeAtContinuousIndex(const ContinuousIndexType &x, OutputType &value, CovariantVectorType &deriv) const
void SetDerivativeWeights(const ContinuousIndexType &x, const vnl_matrix< long > &EvaluateIndex, vnl_matrix< double > &weights, unsigned int splineOrder) const
~BSplineInterpolateImageFunction() override=default
typename CoefficientFilter::Pointer CoefficientFilterPointer
virtual void EvaluateValueAndDerivativeAtContinuousIndexInternal(const ContinuousIndexType &x, OutputType &value, CovariantVectorType &derivativeValue, vnl_matrix< long > &evaluateIndex, vnl_matrix< double > &weights, vnl_matrix< double > &weightsDerivative) const
BSplineInterpolateImageFunction()
void DetermineRegionOfSupport(vnl_matrix< long > &evaluateIndex, const ContinuousIndexType &x, unsigned int splineOrder) const
virtual OutputType EvaluateAtContinuousIndexInternal(const ContinuousIndexType &x, vnl_matrix< long > &evaluateIndex, vnl_matrix< double > &weights) const
CovariantVectorType EvaluateDerivative(const PointType &point) const
std::unique_ptr< vnl_matrix< long >[]> m_ThreadedEvaluateIndex
OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &index) const override
virtual CovariantVectorType EvaluateDerivativeAtContinuousIndexInternal(const ContinuousIndexType &x, vnl_matrix< long > &evaluateIndex, vnl_matrix< double > &weights, vnl_matrix< double > &weightsDerivative) const
CovariantVectorType EvaluateDerivativeAtContinuousIndex(const ContinuousIndexType &x) const
void ApplyMirrorBoundaryConditions(vnl_matrix< long > &evaluateIndex, unsigned int splineOrder) const
virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &x, ThreadIdType threadId) const
A templated class holding a n-Dimensional covariant vector.
NumericTraits< TInputImage::PixelType >::RealType OutputType
Templated n-dimensional image class.
Control indentation during Print() invocation.
Base class for all image interpolators.
typename InputImageType::SizeType SizeType
Light weight base class for most itk classes.
SmartPointer< Self > Pointer
ImageBaseType::IndexType IndexType
ImageBaseType::PointType PointType
ImageBaseType::SizeType SizeType
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
unsigned int ThreadIdType