#include <itkBSplineInterpolateImageFunction.h>
Evaluates the B-Spline interpolation of an image. Spline order may be from 0 to 5.
This class defines N-Dimension B-Spline transformation. It is based on [141], [139] and [140]. Code obtained from bigwww.epfl.ch by Philippe Thevenaz
The B spline coefficients are calculated through the BSplineDecompositionImageFilter
Limitations: Spline order must be between 0 and 5. Spline order must be set before setting the image. Uses mirror boundary conditions. Requires the same order of Spline for each dimension. Spline is determined in all dimensions, cannot selectively pick dimension for calculating spline.
Definition at line 69 of file itkBSplineInterpolateImageFunction.h.
Inheritance diagram for itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >:
Collaboration diagram for itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >:Static Public Member Functions | |
| static Pointer | New () |
Static Public Member Functions inherited from itk::Object | |
| static bool | GetGlobalWarningDisplay () |
| static void | GlobalWarningDisplayOff () |
| static void | GlobalWarningDisplayOn () |
| static Pointer | New () |
| static void | SetGlobalWarningDisplay (bool val) |
Static Public Member Functions inherited from itk::LightObject | |
| static void | BreakOnError () |
| static Pointer | New () |
Static Public Attributes | |
| static constexpr unsigned int | ImageDimension = Superclass::ImageDimension |
Static Public Attributes inherited from itk::InterpolateImageFunction< TImageType, double > | |
| static constexpr unsigned int | ImageDimension |
Static Public Attributes inherited from itk::ImageFunction< TImageType, NumericTraits< TImageType::PixelType >::RealType, double > | |
| static constexpr unsigned int | ImageDimension |
Protected Member Functions | |
| BSplineInterpolateImageFunction () | |
| virtual OutputType | EvaluateAtContinuousIndexInternal (const ContinuousIndexType &x, vnl_matrix< long > &evaluateIndex, vnl_matrix< double > &weights) const |
| virtual CovariantVectorType | EvaluateDerivativeAtContinuousIndexInternal (const ContinuousIndexType &x, vnl_matrix< long > &evaluateIndex, vnl_matrix< double > &weights, vnl_matrix< double > &weightsDerivative) const |
| virtual void | EvaluateValueAndDerivativeAtContinuousIndexInternal (const ContinuousIndexType &x, OutputType &value, CovariantVectorType &derivativeValue, vnl_matrix< long > &evaluateIndex, vnl_matrix< double > &weights, vnl_matrix< double > &weightsDerivative) const |
| void | PrintSelf (std::ostream &os, Indent indent) const override |
| ~BSplineInterpolateImageFunction () override=default | |
Protected Member Functions inherited from itk::InterpolateImageFunction< TImageType, double > | |
| InterpolateImageFunction ()=default | |
| void | PrintSelf (std::ostream &os, Indent indent) const override |
| ~InterpolateImageFunction () override=default | |
Protected Member Functions inherited from itk::ImageFunction< TImageType, NumericTraits< TImageType::PixelType >::RealType, double > | |
| ImageFunction () | |
| ~ImageFunction () override=default | |
Protected Member Functions inherited from itk::FunctionBase< Point< double, TImageType::ImageDimension >, NumericTraits< TImageType::PixelType >::RealType > | |
| FunctionBase ()=default | |
| ~FunctionBase () override=default | |
Protected Member Functions inherited from itk::Object | |
| Object () | |
| bool | PrintObservers (std::ostream &os, Indent indent) const |
| void | PrintSelf (std::ostream &os, Indent indent) const override |
| virtual void | SetTimeStamp (const TimeStamp &timeStamp) |
| ~Object () override | |
Protected Member Functions inherited from itk::LightObject | |
| virtual LightObject::Pointer | InternalClone () const |
| LightObject () | |
| virtual void | PrintHeader (std::ostream &os, Indent indent) const |
| virtual void | PrintTrailer (std::ostream &os, Indent indent) const |
| virtual | ~LightObject () |
Protected Attributes | |
| CoefficientImageType::ConstPointer | m_Coefficients {} |
| TImageType::SizeType | m_DataLength {} |
| std::vector< CoefficientDataType > | m_Scratch {} |
| unsigned int | m_SplineOrder {} |
Protected Attributes inherited from itk::ImageFunction< TImageType, NumericTraits< TImageType::PixelType >::RealType, double > | |
| ContinuousIndexType | m_EndContinuousIndex |
| IndexType | m_EndIndex |
| InputImageConstPointer | m_Image |
| ContinuousIndexType | m_StartContinuousIndex |
| IndexType | m_StartIndex |
Protected Attributes inherited from itk::LightObject | |
| std::atomic< int > | m_ReferenceCount {} |
Private Member Functions | |
| void | ApplyMirrorBoundaryConditions (vnl_matrix< long > &evaluateIndex, unsigned int splineOrder) const |
| void | DetermineRegionOfSupport (vnl_matrix< long > &evaluateIndex, const ContinuousIndexType &x, unsigned int splineOrder) const |
| void | GeneratePointsToIndex () |
| void | SetDerivativeWeights (const ContinuousIndexType &x, const vnl_matrix< long > &EvaluateIndex, vnl_matrix< double > &weights, unsigned int splineOrder) const |
| void | SetInterpolationWeights (const ContinuousIndexType &x, const vnl_matrix< long > &EvaluateIndex, vnl_matrix< double > &weights, unsigned int splineOrder) const |
Private Attributes | |
| Iterator | m_CIterator {} |
| CoefficientFilterPointer | m_CoefficientFilter {} |
| unsigned long | m_MaxNumberInterpolationPoints {} |
| ThreadIdType | m_NumberOfWorkUnits {} |
| std::vector< IndexType > | m_PointsToIndex {} |
| std::unique_ptr< vnl_matrix< long >[]> | m_ThreadedEvaluateIndex |
| std::unique_ptr< vnl_matrix< double >[]> | m_ThreadedWeights |
| std::unique_ptr< vnl_matrix< double >[]> | m_ThreadedWeightsDerivative |
| bool | m_UseImageDirection { true } |
| using itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >::CoefficientDataType = TCoefficientType |
Internal Coefficient type alias support
Definition at line 111 of file itkBSplineInterpolateImageFunction.h.
| using itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >::CoefficientFilter = BSplineDecompositionImageFilter<TImageType, CoefficientImageType> |
Define filter for calculating the BSpline coefficients
Definition at line 115 of file itkBSplineInterpolateImageFunction.h.
| using itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >::CoefficientFilterPointer = typename CoefficientFilter::Pointer |
Definition at line 116 of file itkBSplineInterpolateImageFunction.h.
| using itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >::CoefficientImageType = Image<CoefficientDataType, Self::ImageDimension> |
Definition at line 112 of file itkBSplineInterpolateImageFunction.h.
| using itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >::ConstPointer = SmartPointer<const Self> |
Definition at line 78 of file itkBSplineInterpolateImageFunction.h.
| using itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >::CovariantVectorType = CovariantVector<OutputType, Self::ImageDimension> |
Derivative type alias support
Definition at line 119 of file itkBSplineInterpolateImageFunction.h.
| using itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >::Iterator = ImageLinearIteratorWithIndex<TImageType> |
Iterator type alias support
Definition at line 108 of file itkBSplineInterpolateImageFunction.h.
| using itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >::Pointer = SmartPointer<Self> |
Definition at line 77 of file itkBSplineInterpolateImageFunction.h.
| using itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >::Self = BSplineInterpolateImageFunction |
Standard class type aliases.
Definition at line 75 of file itkBSplineInterpolateImageFunction.h.
| using itk::InterpolateImageFunction< TImageType, TCoordinate >::SizeType |
Size type alias support
Definition at line 79 of file itkInterpolateImageFunction.h.
| using itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >::Superclass = InterpolateImageFunction<TImageType, TCoordinate> |
Definition at line 76 of file itkBSplineInterpolateImageFunction.h.
|
protected |
|
overrideprotecteddefault |
|
private |
Set the indices in evaluateIndex at the boundaries based on mirror boundary conditions.
|
virtual |
Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.
Reimplemented from itk::LightObject.
Reimplemented in itk::BSplineResampleImageFunction< TImageType, TCoordinate >.
|
private |
Determines the indices to use give the splines region of support
|
inlineoverridevirtual |
Evaluate the function at a ContinuousIndex position.
Returns the B-Spline interpolated image intensity at a specified point position. No bounds checking is done. The point is assume to lie within the image buffer.
ImageFunction::IsInsideBuffer() can be used to check bounds before calling the method.
Implements itk::ImageFunction< TImageType, NumericTraits< TImageType::PixelType >::RealType, double >.
Definition at line 130 of file itkBSplineInterpolateImageFunction.h.
|
inlinevirtual |
Definition at line 139 of file itkBSplineInterpolateImageFunction.h.
|
inlineoverridevirtual |
Interpolate the image at a continuous index position
Returns the interpolated image intensity at a specified index position. No bounds checking is done. The point is assume to lie within the image buffer.
Subclasses must override this method.
ImageFunction::IsInsideBuffer() can be used to check bounds before calling the method.
Implements itk::InterpolateImageFunction< TImageType, double >.
Definition at line 147 of file itkBSplineInterpolateImageFunction.h.
|
inlinevirtual |
Definition at line 160 of file itkBSplineInterpolateImageFunction.h.
|
protectedvirtual |
The following methods take working space (evaluateIndex, weights, weightsDerivative) that is managed by the caller. If threadId is known, the working variables are looked up in the thread indexed arrays. If threadId is not known, working variables are made on the stack and passed to these methods. The stack allocation should be ok since these methods do not store the working variables, i.e. they are not expected to be available beyond the scope of the function call.
This was done to allow for two types of re-entrancy. The first is when a threaded filter, e.g. InterpolateImagePointsFilter calls EvaluateAtContinuousIndex from multiple threads without passing a threadId. So, EvaluateAtContinuousIndex must be thread safe. This is handled with the stack-based allocation of the working space.
The second form of re-entrancy involves methods that call EvaluateAtContinuousIndex from multiple threads, but pass a threadId. In this case, we can gain a little efficiency (hopefully) by looking up pre-allocated working space in arrays that are indexed by thread. The efficiency gain is likely dependent on the size of the working variables, which are in-turn dependent on the dimensionality of the image and the order of the spline.
|
inline |
Definition at line 167 of file itkBSplineInterpolateImageFunction.h.
|
inline |
Definition at line 177 of file itkBSplineInterpolateImageFunction.h.
|
inline |
Definition at line 185 of file itkBSplineInterpolateImageFunction.h.
|
inline |
Definition at line 202 of file itkBSplineInterpolateImageFunction.h.
|
protectedvirtual |
|
inline |
Definition at line 209 of file itkBSplineInterpolateImageFunction.h.
|
inline |
Definition at line 219 of file itkBSplineInterpolateImageFunction.h.
|
inline |
Definition at line 230 of file itkBSplineInterpolateImageFunction.h.
|
inline |
Definition at line 250 of file itkBSplineInterpolateImageFunction.h.
|
protectedvirtual |
|
private |
Precomputation for converting the 1D index of the interpolation neighborhood to an N-dimensional index.
|
virtual |
Reimplemented from itk::InterpolateImageFunction< TImageType, double >.
Reimplemented in itk::BSplineResampleImageFunction< TImageType, TCoordinate >.
|
virtual |
|
inlineoverridevirtual |
Get the radius required for interpolation.
This defines the number of surrounding pixels required to interpolate at a given point.
Implements itk::InterpolateImageFunction< TImageType, double >.
Definition at line 296 of file itkBSplineInterpolateImageFunction.h.
|
virtual |
|
virtual |
The UseImageDirection flag determines whether image derivatives are computed with respect to the image grid or with respect to the physical space. When this flag is ON the derivatives are computed with respect to the coordinate system of physical space. The difference is whether we take into account the image Direction or not. The flag ON will take into account the image direction and will result in an extra matrix multiplication compared to the amount of computation performed when the flag is OFF. The default value of this flag is On.
|
static |
New macro for creation of through a Smart Pointer
|
overrideprotectedvirtual |
Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from itk::LightObject.
|
private |
Determines the weights for the derivative portion of the value x
|
overridevirtual |
Set the input image. This must be set by the user.
Reimplemented from itk::ImageFunction< TImageType, NumericTraits< TImageType::PixelType >::RealType, double >.
Reimplemented in itk::BSplineResampleImageFunction< TImageType, TCoordinate >.
|
private |
Determines the weights for interpolation of the value x
| void itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >::SetNumberOfWorkUnits | ( | ThreadIdType | numWorkUnits | ) |
| void itk::BSplineInterpolateImageFunction< TImageType, TCoordinate, TCoefficientType >::SetSplineOrder | ( | unsigned int | SplineOrder | ) |
Get/Sets the Spline Order, supports 0th - 5th order splines. The default is a 3rd order spline.
|
virtual |
The UseImageDirection flag determines whether image derivatives are computed with respect to the image grid or with respect to the physical space. When this flag is ON the derivatives are computed with respect to the coordinate system of physical space. The difference is whether we take into account the image Direction or not. The flag ON will take into account the image direction and will result in an extra matrix multiplication compared to the amount of computation performed when the flag is OFF. The default value of this flag is On.
|
virtual |
The UseImageDirection flag determines whether image derivatives are computed with respect to the image grid or with respect to the physical space. When this flag is ON the derivatives are computed with respect to the coordinate system of physical space. The difference is whether we take into account the image Direction or not. The flag ON will take into account the image direction and will result in an extra matrix multiplication compared to the amount of computation performed when the flag is OFF. The default value of this flag is On.
|
virtual |
The UseImageDirection flag determines whether image derivatives are computed with respect to the image grid or with respect to the physical space. When this flag is ON the derivatives are computed with respect to the coordinate system of physical space. The difference is whether we take into account the image Direction or not. The flag ON will take into account the image direction and will result in an extra matrix multiplication compared to the amount of computation performed when the flag is OFF. The default value of this flag is On.
|
staticconstexpr |
Dimension underlying input image.
Definition at line 93 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 386 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 398 of file itkBSplineInterpolateImageFunction.h.
|
protected |
Definition at line 353 of file itkBSplineInterpolateImageFunction.h.
|
protected |
Definition at line 348 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 389 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 404 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 393 of file itkBSplineInterpolateImageFunction.h.
|
protected |
Definition at line 346 of file itkBSplineInterpolateImageFunction.h.
|
protected |
Definition at line 350 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 405 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 406 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 407 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 402 of file itkBSplineInterpolateImageFunction.h.