ITK
4.13.0
Insight Segmentation and Registration Toolkit
|
#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: [1] M. Unser, "Splines: A Perfect Fit for Signal and Image Processing," IEEE Signal Processing Magazine, vol. 16, no. 6, pp. 22-38, November 1999. [2] M. Unser, A. Aldroubi and M. Eden, "B-Spline Signal Processing: Part I--Theory," IEEE Transactions on Signal Processing, vol. 41, no. 2, pp. 821-832, February 1993. [3] M. Unser, A. Aldroubi and M. Eden, "B-Spline Signal Processing: Part II--Efficient Design and Applications," IEEE Transactions on Signal Processing, vol. 41, no. 2, pp. 834-848, February 1993. And 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 84 of file itkBSplineInterpolateImageFunction.h.
Public Types | |
typedef TCoefficientType | CoefficientDataType |
typedef BSplineDecompositionImageFilter < TImageType, CoefficientImageType > | CoefficientFilter |
typedef CoefficientFilter::Pointer | CoefficientFilterPointer |
typedef Image < CoefficientDataType, itkGetStaticConstMacro(ImageDimension) > | CoefficientImageType |
typedef SmartPointer< const Self > | ConstPointer |
typedef Superclass::ContinuousIndexType | ContinuousIndexType |
typedef CovariantVector < OutputType, itkGetStaticConstMacro(ImageDimension) > | CovariantVectorType |
typedef Superclass::IndexType | IndexType |
typedef Superclass::InputImageType | InputImageType |
typedef ImageLinearIteratorWithIndex < TImageType > | Iterator |
typedef Superclass::OutputType | OutputType |
typedef SmartPointer< Self > | Pointer |
typedef Superclass::PointType | PointType |
typedef BSplineInterpolateImageFunction | Self |
typedef InterpolateImageFunction < TImageType, TCoordRep > | Superclass |
Public Types inherited from itk::InterpolateImageFunction< TImageType, TCoordRep > | |
typedef SmartPointer< const Self > | ConstPointer |
typedef Superclass::ContinuousIndexType | ContinuousIndexType |
typedef Superclass::IndexType | IndexType |
typedef Superclass::IndexValueType | IndexValueType |
typedef Superclass::InputImageType | InputImageType |
typedef Superclass::OutputType | OutputType |
typedef SmartPointer< Self > | Pointer |
typedef Superclass::PointType | PointType |
typedef NumericTraits < typename TImageType::PixelType > ::RealType | RealType |
typedef InterpolateImageFunction | Self |
typedef ImageFunction < TImageType, typename NumericTraits< typename TImageType::PixelType > ::RealType, TCoordRep > | Superclass |
Public Types inherited from itk::ImageFunction< TImageType, NumericTraits< TImageType::PixelType >::RealType, TCoordRep > | |
typedef SmartPointer< const Self > | ConstPointer |
typedef ContinuousIndex < TCoordRep, itkGetStaticConstMacro(ImageDimension) > | ContinuousIndexType |
typedef TCoordRep | CoordRepType |
typedef InputImageType::IndexType | IndexType |
typedef InputImageType::IndexValueType | IndexValueType |
typedef InputImageType::ConstPointer | InputImageConstPointer |
typedef TImageType | InputImageType |
typedef InputImageType::PixelType | InputPixelType |
typedef NumericTraits < TImageType::PixelType > ::RealType | OutputType |
typedef SmartPointer< Self > | Pointer |
typedef Point< TCoordRep, itkGetStaticConstMacro(ImageDimension) > | PointType |
typedef ImageFunction | Self |
typedef FunctionBase< Point < TCoordRep, itkGetStaticConstMacro(ImageDimension) > , NumericTraits < TImageType::PixelType > ::RealType > | Superclass |
Public Types inherited from itk::FunctionBase< Point< TCoordRep, TImageType::ImageDimension >, NumericTraits< TImageType::PixelType >::RealType > | |
typedef SmartPointer< const Self > | ConstPointer |
typedef Point< TCoordRep, TImageType::ImageDimension > | InputType |
typedef NumericTraits < TImageType::PixelType > ::RealType | OutputType |
typedef SmartPointer< Self > | Pointer |
typedef FunctionBase | Self |
typedef Object | Superclass |
Public Types inherited from itk::Object | |
typedef SmartPointer< const Self > | ConstPointer |
typedef SmartPointer< Self > | Pointer |
typedef Object | Self |
typedef LightObject | Superclass |
Public Types inherited from itk::LightObject | |
typedef SmartPointer< const Self > | ConstPointer |
typedef SmartPointer< Self > | Pointer |
typedef LightObject | Self |
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 flag) |
Static Public Member Functions inherited from itk::LightObject | |
static void | BreakOnError () |
static Pointer | New () |
Static Public Attributes | |
static const unsigned int | ImageDimension = Superclass::ImageDimension |
Static Public Attributes inherited from itk::InterpolateImageFunction< TImageType, TCoordRep > | |
static const unsigned int | ImageDimension |
Static Public Attributes inherited from itk::ImageFunction< TImageType, NumericTraits< TImageType::PixelType >::RealType, TCoordRep > | |
static const unsigned int | ImageDimension |
Protected Member Functions | |
BSplineInterpolateImageFunction () | |
virtual OutputType | EvaluateAtContinuousIndexInternal (const ContinuousIndexType &index, 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 | |
Protected Member Functions inherited from itk::InterpolateImageFunction< TImageType, TCoordRep > | |
InterpolateImageFunction () | |
void | PrintSelf (std::ostream &os, Indent indent) const override |
~InterpolateImageFunction () override | |
Protected Member Functions inherited from itk::ImageFunction< TImageType, NumericTraits< TImageType::PixelType >::RealType, TCoordRep > | |
ImageFunction () | |
~ImageFunction () override | |
Protected Member Functions inherited from itk::FunctionBase< Point< TCoordRep, TImageType::ImageDimension >, NumericTraits< TImageType::PixelType >::RealType > | |
FunctionBase () | |
~FunctionBase () override | |
Protected Member Functions inherited from itk::Object | |
Object () | |
bool | PrintObservers (std::ostream &os, Indent indent) const |
virtual void | SetTimeStamp (const TimeStamp &time) |
virtual | ~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, TCoordRep > | |
ContinuousIndexType | m_EndContinuousIndex |
IndexType | m_EndIndex |
InputImageConstPointer | m_Image |
ContinuousIndexType | m_StartContinuousIndex |
IndexType | m_StartIndex |
Protected Attributes inherited from itk::LightObject | |
AtomicInt< 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_NumberOfThreads |
std::vector< IndexType > | m_PointsToIndex |
vnl_matrix< long > * | m_ThreadedEvaluateIndex |
vnl_matrix< double > * | m_ThreadedWeights |
vnl_matrix< double > * | m_ThreadedWeightsDerivative |
bool | m_UseImageDirection |
typedef TCoefficientType itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::CoefficientDataType |
Internal Coefficient typedef support
Definition at line 122 of file itkBSplineInterpolateImageFunction.h.
typedef BSplineDecompositionImageFilter< TImageType, CoefficientImageType > itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::CoefficientFilter |
Define filter for calculating the BSpline coefficients
Definition at line 128 of file itkBSplineInterpolateImageFunction.h.
typedef CoefficientFilter::Pointer itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::CoefficientFilterPointer |
Definition at line 129 of file itkBSplineInterpolateImageFunction.h.
typedef Image< CoefficientDataType, itkGetStaticConstMacro(ImageDimension) > itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::CoefficientImageType |
Definition at line 125 of file itkBSplineInterpolateImageFunction.h.
typedef SmartPointer< const Self > itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::ConstPointer |
Definition at line 92 of file itkBSplineInterpolateImageFunction.h.
typedef Superclass::ContinuousIndexType itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::ContinuousIndexType |
ContinuousIndex typedef support.
Definition at line 113 of file itkBSplineInterpolateImageFunction.h.
typedef CovariantVector< OutputType, itkGetStaticConstMacro(ImageDimension) > itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::CovariantVectorType |
Derivative typedef support
Definition at line 134 of file itkBSplineInterpolateImageFunction.h.
typedef Superclass::IndexType itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::IndexType |
Index typedef support.
Definition at line 110 of file itkBSplineInterpolateImageFunction.h.
typedef Superclass::InputImageType itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::InputImageType |
InputImageType typedef support.
Definition at line 104 of file itkBSplineInterpolateImageFunction.h.
typedef ImageLinearIteratorWithIndex< TImageType > itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::Iterator |
Iterator typedef support
Definition at line 119 of file itkBSplineInterpolateImageFunction.h.
typedef Superclass::OutputType itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::OutputType |
OutputType typedef support.
Definition at line 98 of file itkBSplineInterpolateImageFunction.h.
typedef SmartPointer< Self > itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::Pointer |
Definition at line 91 of file itkBSplineInterpolateImageFunction.h.
typedef Superclass::PointType itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::PointType |
PointType typedef support
Definition at line 116 of file itkBSplineInterpolateImageFunction.h.
typedef BSplineInterpolateImageFunction itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::Self |
Standard class typedefs.
Definition at line 89 of file itkBSplineInterpolateImageFunction.h.
typedef InterpolateImageFunction< TImageType, TCoordRep > itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::Superclass |
Definition at line 90 of file itkBSplineInterpolateImageFunction.h.
|
protected |
|
overrideprotected |
|
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::Object.
|
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.
Definition at line 144 of file itkBSplineInterpolateImageFunction.h.
|
inlinevirtual |
Definition at line 154 of file itkBSplineInterpolateImageFunction.h.
|
inlineoverridevirtual |
Definition at line 164 of file itkBSplineInterpolateImageFunction.h.
|
virtual |
|
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 183 of file itkBSplineInterpolateImageFunction.h.
|
inline |
Definition at line 193 of file itkBSplineInterpolateImageFunction.h.
|
inline |
Definition at line 203 of file itkBSplineInterpolateImageFunction.h.
CovariantVectorType itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::EvaluateDerivativeAtContinuousIndex | ( | const ContinuousIndexType & | x, |
ThreadIdType | threadId | ||
) | const |
|
protectedvirtual |
|
inline |
Definition at line 227 of file itkBSplineInterpolateImageFunction.h.
|
inline |
Definition at line 242 of file itkBSplineInterpolateImageFunction.h.
|
inline |
Definition at line 257 of file itkBSplineInterpolateImageFunction.h.
void itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::EvaluateValueAndDerivativeAtContinuousIndex | ( | const ContinuousIndexType & | x, |
OutputType & | value, | ||
CovariantVectorType & | deriv, | ||
ThreadIdType | threadId | ||
) | const |
|
protectedvirtual |
|
private |
Precomputation for converting the 1D index of the interpolation neighborhood to an N-dimensional index.
|
virtual |
Run-time type information (and related methods).
Reimplemented from itk::InterpolateImageFunction< TImageType, TCoordRep >.
Reimplemented in itk::BSplineResampleImageFunction< TImageType, TCoordRep >.
|
virtual |
|
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::Object.
|
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, TCoordRep >.
Reimplemented in itk::BSplineResampleImageFunction< TImageType, TCoordRep >.
|
private |
Determines the weights for interpolation of the value x
void itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >::SetNumberOfThreads | ( | ThreadIdType | numThreads | ) |
void itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, 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.
|
static |
Dimension underlying input image.
Definition at line 107 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 398 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 410 of file itkBSplineInterpolateImageFunction.h.
|
protected |
Definition at line 367 of file itkBSplineInterpolateImageFunction.h.
|
protected |
Definition at line 362 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 401 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 416 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 405 of file itkBSplineInterpolateImageFunction.h.
|
protected |
Definition at line 360 of file itkBSplineInterpolateImageFunction.h.
|
protected |
Definition at line 364 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 417 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 418 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 419 of file itkBSplineInterpolateImageFunction.h.
|
private |
Definition at line 414 of file itkBSplineInterpolateImageFunction.h.