A.I.M.S algorithms


SplineResampler< T > Class Template Referenceabstract

B-Spline-based resampling. More...

#include <aims/resampling/splineresampler.h>

Inheritance diagram for SplineResampler< T >:
Collaboration diagram for SplineResampler< T >:

Public Member Functions

 SplineResampler ()
 
 ~SplineResampler ()
 
virtual int getOrder () const =0
 Spline order (1 to 7) More...
 
AimsData< double > getSplineCoef (const AimsData< T > &inVolume, int t=0, bool verbose=false)
 Computes spline coefficients corresponding to an input volume. More...
 
void reset ()
 Clear the cache. More...
 
- Public Member Functions inherited from Resampler< T >
 Resampler ()
 
virtual ~Resampler ()
 
virtual void doit (const aims::AffineTransformation3d &transform, AimsData< T > &output_data)
 Resample the reference input data (set via setRef()) into an existing output data. More...
 
virtual AimsData< T > doit (const aims::AffineTransformation3d &transform, int dimX, int dimY, int dimZ, const Point3df &voxel_size)
 Resample the reference input data (set via setRef()) into a new output data. More...
 
virtual void resample (const AimsData< T > &input_data, const aims::AffineTransformation3d &transform, const T &background, AimsData< T > &output_data, bool verbose=false)
 Resample the input data into an existing output data. More...
 
virtual void resample (const AimsData< T > &input_data, const aims::AffineTransformation3d &transform, const T &background, const Point3df &output_location, T &output_value, int timestep)
 Resample a single voxel of the input data at a given specified output location, and set the output value. More...
 
void setRef (const AimsData< T > &ref)
 set the input data to be resampled More...
 
void setDefaultValue (T val)
 set the default background value More...
 

Protected Member Functions

void doResample (const AimsData< T > &inVolume, const Motion &transform3d, const T &outBackground, const Point3df &outLocation, T &outValue, int t)
 Resample a point. More...
 
void updateParameters (const AimsData< T > &inVolume, int t, bool verbose)
 
void iirConvolveMirror (std::vector< double > &data) const
 
int getFold (int i, int size) const
 
virtual double getBSplineWeight (int i, double x) const =0
 Returns B^n( x - i ) More...
 

Protected Attributes

std::vector< double > _poles
 
double _gain
 
AimsData< double > _splineCoefficients
 
const AimsData< T > * _lastvolume
 
int _lasttime
 
- Protected Attributes inherited from Resampler< T >
const AimsData< T > * _ref
 
_defval
 

Detailed Description

template<class T>
class SplineResampler< T >

B-Spline-based resampling.

This is the base class for all resamplers based on B-spline interpolation as described by Unser, Aldroubi & Eden in IEEE PAMI (1991). A class computing the actual spline coefficient is derived for each spline order (1 to 7).

See also
LinearResampler CubicResampler QuadraticResampler QuinticResampler SixthOrderResampler SeventhOrderResampler

Coefficients are computed through a recursive scheme from an input reference volume. This recursive algorithm is fast for whole volume resampling, but slower for single points. A cache mechanism has thus been implemented so that coefficients are not recomputed if the input volume did not change.

For an input volume inVolume of dimensions [dimX, dimY, dimZ], coefficients are double precision values stored in a volume of same dimensions. Any value inVolume*(x, y, z) can then be interpolated through the formula:
inVolume*(x, y, z) = Sum[i]( c_i * B^n(x - x_i) * B^n(y - y_i) * B^n(z - z_i) )
with c_i the coefficients, B^n a nth order B-spline and (x_i, y_i, z_i) the discrete input image points. Given that the support of B^n is ]-(n+1)/2, (n+1)/2[, only the (n+1)^d (with d the volume dimension in [1,2,3]) closest coefficients/discrete points are used to interpolate a given point.

Template Parameters
TVoxel data type

Definition at line 72 of file splineresampler.h.

Constructor & Destructor Documentation

template<class T >
SplineResampler< T >::SplineResampler ( )

Definition at line 44 of file splineresampler_d.h.

template<class T>
SplineResampler< T >::~SplineResampler ( )
inline

Definition at line 77 of file splineresampler.h.

Member Function Documentation

template<class T>
void SplineResampler< T >::doResample ( const AimsData< T > &  inVolume,
const Motion transform3d,
const T &  outBackground,
const Point3df outLocation,
T &  outValue,
int  t 
)
protectedvirtual

Resample a point.

A call to getSplineCoef() or updateParameters() must have been made using inVolume before.

Parameters
inVolumevolume to resample
transform3d

Implements Resampler< T >.

Definition at line 72 of file splineresampler_d.h.

References AimsData< T >::dimX(), AimsData< T >::dimY(), AimsData< T >::dimZ(), and aims::AffineTransformation3d::transform().

template<class T>
virtual double SplineResampler< T >::getBSplineWeight ( int  i,
double  x 
) const
protectedpure virtual
template<class T >
int SplineResampler< T >::getFold ( int  i,
int  size 
) const
protected

Definition at line 536 of file splineresampler_d.h.

template<class T>
virtual int SplineResampler< T >::getOrder ( ) const
pure virtual
template<class T>
AimsData< double > SplineResampler< T >::getSplineCoef ( const AimsData< T > &  inVolume,
int  t = 0,
bool  verbose = false 
)

Computes spline coefficients corresponding to an input volume.

Spline coefficients are recomputed only if one of these conditions is satisfied:

  • inVolume is different from the last volume used for coefficients computation (in the sense that they share the same adress)
  • t is different from the last t used for coefficients computation
  • A call to reset() has previously been made
Parameters
inVolumeinput image
tvolume to use in the T dimension in the case where inVolume is a time series.
Returns
Volume of double containing the coefficients in the image domain. Border coefficient need to be retrieved by mirror.

This method actually calls updateParameters() ad returns the coeff container

Definition at line 60 of file splineresampler_d.h.

template<class T >
void SplineResampler< T >::iirConvolveMirror ( std::vector< double > &  data) const
protected

Definition at line 423 of file splineresampler_d.h.

References EPSILON.

template<class T >
void SplineResampler< T >::reset ( )

Clear the cache.

After a call to this method, a call to getSplineCoef() recomputes the spline coefficients in any case.

Definition at line 51 of file splineresampler_d.h.

template<class T>
void SplineResampler< T >::updateParameters ( const AimsData< T > &  inVolume,
int  t,
bool  verbose 
)
protectedvirtual

Member Data Documentation

template<class T>
int SplineResampler< T >::_lasttime
protected

Definition at line 151 of file splineresampler.h.

template<class T>
const AimsData<T>* SplineResampler< T >::_lastvolume
protected

Definition at line 150 of file splineresampler.h.

template<class T>
AimsData<double> SplineResampler< T >::_splineCoefficients
protected

Definition at line 149 of file splineresampler.h.


The documentation for this class was generated from the following files: