template<typename TImageType, typename TCoordRep = double, typename TCoefficientType = double>
class itk::BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType >
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.
- See also
- BSplineDecompositionImageFilter
- Examples
- Examples/Filtering/ResampleImageFilter7.cxx, and SphinxExamples/src/Filtering/ImageGrid/UpsampleAnImage/Code.cxx.
Definition at line 83 of file itkBSplineInterpolateImageFunction.h.
|
using | CoefficientDataType = TCoefficientType |
|
using | CoefficientFilter = BSplineDecompositionImageFilter< TImageType, CoefficientImageType > |
|
using | CoefficientFilterPointer = typename CoefficientFilter::Pointer |
|
using | CoefficientImageType = Image< CoefficientDataType, Self::ImageDimension > |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | CovariantVectorType = CovariantVector< OutputType, Self::ImageDimension > |
|
using | Iterator = ImageLinearIteratorWithIndex< TImageType > |
|
using | Pointer = SmartPointer< Self > |
|
using | Self = BSplineInterpolateImageFunction |
|
using | Superclass = InterpolateImageFunction< TImageType, TCoordRep > |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | Pointer = SmartPointer< Self > |
|
using | RealType = typename NumericTraits< typename TImageType ::PixelType >::RealType |
|
using | Self = InterpolateImageFunction |
|
using | SizeType = typename InputImageType::SizeType |
|
using | Superclass = ImageFunction< TImageType, typename NumericTraits< typename TImageType ::PixelType >::RealType, TCoordRep > |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | ContinuousIndexType = ContinuousIndex< TCoordRep, Self::ImageDimension > |
|
using | CoordRepType = TCoordRep |
|
using | IndexType = typename InputImageType::IndexType |
|
using | IndexValueType = typename InputImageType::IndexValueType |
|
using | InputImageConstPointer = typename InputImageType::ConstPointer |
|
using | InputImageType = TImageType |
|
using | InputPixelType = typename InputImageType::PixelType |
|
using | OutputType = NumericTraits< TImageType ::PixelType >::RealType |
|
using | Pointer = SmartPointer< Self > |
|
using | PointType = Point< TCoordRep, Self::ImageDimension > |
|
using | Self = ImageFunction |
|
using | Superclass = FunctionBase< Point< TCoordRep, Self::ImageDimension >, NumericTraits< TImageType ::PixelType >::RealType > |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | InputType = Point< TCoordRep, TImageType ::ImageDimension > |
|
using | OutputType = NumericTraits< TImageType ::PixelType >::RealType |
|
using | Pointer = SmartPointer< Self > |
|
using | Self = FunctionBase |
|
using | Superclass = Object |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | Pointer = SmartPointer< Self > |
|
using | Self = Object |
|
using | Superclass = LightObject |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | Pointer = SmartPointer< Self > |
|
using | Self = LightObject |
|
|
virtual OutputType | Evaluate (const PointType &point, ThreadIdType threadId) const |
|
OutputType | EvaluateAtContinuousIndex (const ContinuousIndexType &index) const override |
|
virtual OutputType | EvaluateAtContinuousIndex (const ContinuousIndexType &x, ThreadIdType threadId) const |
|
CovariantVectorType | EvaluateDerivative (const PointType &point) const |
|
CovariantVectorType | EvaluateDerivative (const PointType &point, ThreadIdType threadId) const |
|
CovariantVectorType | EvaluateDerivativeAtContinuousIndex (const ContinuousIndexType &x) const |
|
CovariantVectorType | EvaluateDerivativeAtContinuousIndex (const ContinuousIndexType &x, ThreadIdType threadId) const |
|
void | EvaluateValueAndDerivative (const PointType &point, OutputType &value, CovariantVectorType &deriv) const |
|
void | EvaluateValueAndDerivative (const PointType &point, OutputType &value, CovariantVectorType &deriv, ThreadIdType threadId) const |
|
void | EvaluateValueAndDerivativeAtContinuousIndex (const ContinuousIndexType &x, OutputType &value, CovariantVectorType &deriv) const |
|
void | EvaluateValueAndDerivativeAtContinuousIndex (const ContinuousIndexType &x, OutputType &value, CovariantVectorType &derivativeValue, ThreadIdType threadId) const |
|
const char * | GetNameOfClass () const override |
|
virtual ThreadIdType | GetNumberOfWorkUnits () const |
|
SizeType | GetRadius () const override |
|
virtual unsigned int | GetSplineOrder () const |
|
void | SetInputImage (const TImageType *inputData) override |
|
void | SetNumberOfWorkUnits (ThreadIdType numThreads) |
|
void | SetSplineOrder (unsigned int SplineOrder) |
|
|
OutputType | Evaluate (const PointType &point) const override |
|
|
virtual void | SetUseImageDirection (bool _arg) |
|
virtual bool | GetUseImageDirection () const |
|
virtual void | UseImageDirectionOn () |
|
OutputType | EvaluateAtIndex (const IndexType &index) const override |
|
const char * | GetNameOfClass () const override |
|
OutputType | Evaluate (const PointType &point) const override |
|
void | ConvertContinuousIndexToNearestIndex (const ContinuousIndexType &cindex, IndexType &index) const |
|
void | ConvertPointToContinuousIndex (const PointType &point, ContinuousIndexType &cindex) const |
|
virtual const ContinuousIndexType & | GetEndContinuousIndex () const |
|
virtual const IndexType & | GetEndIndex () const |
|
const InputImageType * | GetInputImage () const |
|
virtual const ContinuousIndexType & | GetStartContinuousIndex () const |
|
virtual const IndexType & | GetStartIndex () const |
|
virtual bool | IsInsideBuffer (const IndexType &index) const |
|
virtual bool | IsInsideBuffer (const ContinuousIndexType &index) const |
|
virtual bool | IsInsideBuffer (const PointType &point) const |
|
void | ConvertPointToNearestIndex (const PointType &point, IndexType &index) const |
|
unsigned long | AddObserver (const EventObject &event, Command *cmd) const |
|
unsigned long | AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const |
|
LightObject::Pointer | CreateAnother () const override |
|
virtual void | DebugOff () const |
|
virtual void | DebugOn () const |
|
Command * | GetCommand (unsigned long tag) |
|
bool | GetDebug () const |
|
MetaDataDictionary & | GetMetaDataDictionary () |
|
const MetaDataDictionary & | GetMetaDataDictionary () const |
|
virtual ModifiedTimeType | GetMTime () const |
|
virtual const TimeStamp & | GetTimeStamp () const |
|
bool | HasObserver (const EventObject &event) const |
|
void | InvokeEvent (const EventObject &) |
|
void | InvokeEvent (const EventObject &) const |
|
virtual void | Modified () const |
|
void | Register () const override |
|
void | RemoveAllObservers () |
|
void | RemoveObserver (unsigned long tag) const |
|
void | SetDebug (bool debugFlag) const |
|
void | SetReferenceCount (int) override |
|
void | UnRegister () const noexcept override |
|
void | SetMetaDataDictionary (const MetaDataDictionary &rhs) |
|
void | SetMetaDataDictionary (MetaDataDictionary &&rrhs) |
|
virtual void | SetObjectName (std::string _arg) |
|
virtual const std::string & | GetObjectName () const |
|
Pointer | Clone () const |
|
virtual void | Delete () |
|
virtual int | GetReferenceCount () const |
|
void | Print (std::ostream &os, Indent indent=0) const |
|
|
| 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 |
|
| InterpolateImageFunction ()=default |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
| ~InterpolateImageFunction () override=default |
|
| ImageFunction () |
|
| ~ImageFunction () override=default |
|
| FunctionBase ()=default |
|
| ~FunctionBase () override=default |
|
| Object () |
|
bool | PrintObservers (std::ostream &os, Indent indent) const |
|
virtual void | SetTimeStamp (const TimeStamp &timeStamp) |
|
| ~Object () override |
|
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 () |
|
template<typename TImageType, typename TCoordRep = double, typename TCoefficientType = double>
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.