vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
vspline::bspline< _value_type, _dimension > Struct Template Reference

class bspline now builds on class bspline_base, adding coefficient storage, while bspline_base provides metadata handling. This separation makes it easier to generate classes which use the same metadata scheme. One concrete example is a class to type-erase a spline (not yet part of the library) which abstracts a spline, hiding the type of it's coefficients. Such a class can inherit from bspline_base and initialize the base class in the c'tor from a given bspline object, resulting in a uniform interface to the metadata. class bspline takes an additional template argument: the value type. This is the type of the coefficients stored in the spline, and it will typically be a single fundamental type or a small aggregate - like a vigra::TinyVector. vspline uses vigra's ExpandElementResult mechanism to inquire for a value type's elementary type and size, which makes it easy to adapt to new value types because the mechanism is traits-based. More...

#include <bspline.h>

Inheritance diagram for vspline::bspline< _value_type, _dimension >:
vspline::bspline_base< _dimension >

Public Types

enum  { channels = ExpandElementResult < value_type >::size }
 number of channels in value_type More...
 
typedef _value_type value_type
 
typedef ExpandElementResult< value_type >::type ele_type
 elementary type of value_type, like float or double More...
 
typedef bspline_base< _dimension > base_type
 
typedef vigra::MultiArray< dimension, value_typearray_type
 if the coefficients are owned, an array of this type holds the data: More...
 
typedef vigra::MultiArrayView< dimension, value_typeview_type
 data are read and written to vigra MultiArrayViews: More...
 
typedef bspline< value_type, dimensionspline_type
 the type of 'this' bspline and of a 'channel view' More...
 
typedef bspline< ele_type, dimensionchannel_view_type
 
typedef vigra::TinyVector< std::ptrdiff_t, dimensionshape_type
 type of a multidimensional index type More...
 
typedef vigra::TinyVector< bc_code, dimensionbcv_type
 nD type for one boundary condition per axis More...
 
- Public Types inherited from vspline::bspline_base< _dimension >
enum  { dimension = _dimension }
 'suck in' the template argument More...
 
typedef vigra::TinyVector< std::ptrdiff_t, dimensionshape_type
 type of a multidimensional index type More...
 
typedef vigra::TinyVector< bc_code, dimensionbcv_type
 nD type for one boundary condition per axis More...
 
typedef vigra::TinyVector< xlf_type, dimensionlimit_type
 nD type for one limit condition per axis More...
 

Public Member Functions

 bspline (shape_type _core_shape, int _spline_degree=3, bcv_type _bcv=bcv_type(MIRROR), xlf_type _tolerance=-1.0, int headroom=0, view_type _space=view_type())
 construct a bspline object with appropriate storage space to contain and process an array of knot point data with shape _core_shape. Depending on the the other parameters passed, more space than _core_shape may be allocated. Once the bspline object is ready, usually it is filled with the knot point data and then the prefiltering needs to be done. This sequence assures that the knot point data are present in memory only once, the prefiltering is done in-place. So the user can create the bspline, fill in data (like, from a file), prefilter, and then evaluate. More...
 
template<typename = std::enable_if < _dimension == 1 >>
 bspline (long _core_shape, int _spline_degree=3, bc_code _bc=MIRROR, xlf_type _tolerance=-1.0, int headroom=0, view_type _space=view_type())
 overloaded constructor for 1D splines. This is useful because if we don't provide it, the caller would have to pass TinyVector < T , 1 > instead of T for the shape and the boundary condition. More...
 
channel_view_type get_channel_view (const int &channel)
 get a bspline object for a single channel of the data. This is lightweight and requires the viewed data to remain present as long as the channel view is used. the channel view inherits all metrics from it's parent, only the MultiArrayViews to the data are different. More...
 
void brace (int axis=-1)
 if the spline coefficients are already known, they obviously don't need to be prefiltered. But in order to be used by vspline's evaluation code, they need to be 'braced' - the 'core' coefficients have to be surrounded by more coeffcients covering the support the evaluator needs to operate without bounds checking inside the spline's defined range. brace() performs this operation. brace() assumes the bspline object has been set up with the desired initial parameters, so that the boundary conditions and metrics are already known and storage is available. brace() can be called for a specific axis, or for the whole container by passing -1. User code will only need to call 'brace' explicitly if the coefficients were modified 'from the outside' - when 'prefilter' is called, 'brace' is called automatically. More...
 
template<class math_ele_type = typename vigra::NumericTraits < ele_type > :: RealPromote, size_t vsize = vspline::vector_traits<math_ele_type>::size>
void prefilter (vspline::xlf_type boost=vspline::xlf_type(1), int njobs=vspline::default_njobs)
 prefilter converts the knot point data in the 'core' area into b-spline coefficients. Bracing/framing will be applied. Even if the degree of the spline is zero or one, prefilter() can be called because it also performs the bracing. the arithmetic of the prefilter is performed in 'math_ele_type', which defaults to the vigra RealPromoted elementary type of the spline's value_type. This default ensures that integral knot point data are handled appropriately and prefiltering them will only suffer from quantization errors, which may be acceptable if the dynamic range is sufficiently large. 'boost' is an additional factor which will be used to amplify the incoming signal. This is intended for cases where the range of the signal has to be widened to fill the dynamic range of the signal's data type (specifically if it is an integral type). User code has to deal with the effects of boosting the signal, the bspline object holds no record of the 'boost' being applied. When evaluating a spline with boosted coefficients, user code will have to provide code to attenuate the resulting signal back into the original range; for an easy way of doing so, see vspline::amplify_type, which is a type derived from vspline::unary_functor providing multiplication with a factor. There is an example of it's application in the context of an integer-valued spline in int_spline.cc. More...
 
template<typename T , typename math_ele_type = typename vigra::NumericTraits < typename vigra::PromoteTraits < ele_type , ET<T> > :: Promote > :: RealPromote, size_t vsize = vspline::vector_traits<math_ele_type>::size>
void prefilter (const vigra::MultiArrayView< dimension, T > &data, vspline::xlf_type boost=vspline::xlf_type(1), int njobs=vspline::default_njobs)
 If data are passed in, they have to have precisely the shape we have set up in core (_core_shape passed into the constructor). These data will then be used in place of any data present in the bspline object to calculate the coefficients. They won't be looked at after prefilter() terminates, so it's safe to pass in a MultiArrayView which is destroyed after the call to prefilter() returns. Any data residing in the bspline object's memory will be overwritten. here, the default math_ele_type ensures that math_ele_type is appropriate for both T and ele_type. More...
 
bool shiftable (int d) const
 'shift' will change the interpretation of the data in a bspline object. d is taken as a difference to add to the current spline degree. Coefficients remain the same, but creating an evaluator from the shifted spline will make the evaluator produce data as if the coefficients were those of a spline of the changed order. Shifting with positive d will efectively blur the interpolated signal, shifting with negative d will sharpen it. For shifting to work, the spline has to have enough 'headroom', meaning that spline_degree + d, the new spline degree, has to be greater or equal to 0 and smaller than the largest supported spline degree (lower fourties) - and, additionally, there has to be a wide-enough brace to allow evaluation with the wider kernel of the higher-degree spline's reconstruction filter. So if a spline is set up with degree 0 and shifted to degree 5, it has to be constructed with an additional headroom of 3 (see the constructor). More...
 
bool shift (int d)
 shift() actually changes the interpretation of the data. The data will be taken to be coefficients of a spline with degree spline_degree + d, and the original degree is lost. This operation is only performed if it is technically safe (see shiftable()). If the shift was performed successfully, this function returns true, false otherwise. Note that, rather than 'shifting' the b-spline object, it's also possible to use a 'shifted' evaluator to produce the same result. See class evaluator's constructor. More...
 
xlf_type lower_limit (const int &axis) const
 
limit_type lower_limit () const
 
xlf_type upper_limit (const int &axis) const
 
limit_type upper_limit () const
 
- Public Member Functions inherited from vspline::bspline_base< _dimension >
xlf_type lower_limit (const int &axis) const
 
limit_type lower_limit () const
 
xlf_type upper_limit (const int &axis) const
 
limit_type upper_limit () const
 
 bspline_base (shape_type _core_shape, int _spline_degree, bcv_type _bcv, xlf_type _tolerance, int headroom)
 The constructor sets up all metrics of the spline from the basic properties given for the spline. Here, no defaults are offered, because this class is meant as a base class for splines only, and the expectation is that no objects of this class will be created. More...
 

Static Public Member Functions

static shape_type get_container_shape (int spline_degree, bcv_type bcv, shape_type core_shape, int headroom)
 convenience method to caculate the shape of a container array needed to hold the coefficients of a spline with the given properties. The arguments are the same as those passed to the bspline object's constructor, but this method is static, so it can be called on the spline's type and does not need an object. I'm including this to make it easier for code which creates the container array externally before constructing the bspline object, rather than relying on class bspline to allocate it's own storage. More...
 
template<typename = std::enable_if < _dimension == 1 >>
static long get_container_shape (int spline_degree, vspline::bc_code bc, long core_shape, int headroom)
 variant for 1D splines. This variant accepts the shape as a plain long, rather than requiring a TinyVector of one long. More...
 
static shape_type get_left_brace_size (int spline_degree, bcv_type bcv)
 get_left_brace_size and get_right_brace_size calculate the size of the brace vspline puts around the 'core' coefficients to allow evaluation inside the defined range (and even slightly beyond) without bounds checking. These routines are static to allow user code to establish vspline's bracing requirements without creating a bspline object. user code might use this information to generate coefficient arrays suitable for use with vspline evaluation code, sidestepping use of a bspline object. More...
 
static shape_type get_right_brace_size (int spline_degree, bcv_type bcv)
 
static xlf_type lower_limit (const bc_code &bc)
 lower_limit returns the lower bound of the spline's defined range. This is usually 0.0, but with REFLECT boundary condition it's -0.5, the lower point of reflection. The lowest coordinate at which the spline can be accessed may be lower: even splines have wider support, and splines with extra headroom add even more room to manoevre. More...
 
static xlf_type upper_limit (const std::size_t &extent, const bc_code &bc)
 upper_limit returns the upper bound of the spline's defined range. This is normally M - 1 if the shape for this axis is M. Splines with REFLECT boundary condition use M - 0.5, the upper point of reflection, and periodic splines use M. The highest coordinate at which the spline may be accessed safely may be higher. More...
 
- Static Public Member Functions inherited from vspline::bspline_base< _dimension >
static xlf_type lower_limit (const bc_code &bc)
 lower_limit returns the lower bound of the spline's defined range. This is usually 0.0, but with REFLECT boundary condition it's -0.5, the lower point of reflection. The lowest coordinate at which the spline can be accessed may be lower: even splines have wider support, and splines with extra headroom add even more room to manoevre. More...
 
static xlf_type upper_limit (const std::size_t &extent, const bc_code &bc)
 upper_limit returns the upper bound of the spline's defined range. This is normally M - 1 if the shape for this axis is M. Splines with REFLECT boundary condition use M - 0.5, the upper point of reflection, and periodic splines use M. The highest coordinate at which the spline may be accessed safely may be higher. More...
 
static shape_type get_left_brace_size (int spline_degree, bcv_type bcv)
 get_left_brace_size and get_right_brace_size calculate the size of the brace vspline puts around the 'core' coefficients to allow evaluation inside the defined range (and even slightly beyond) without bounds checking. These routines are static to allow user code to establish vspline's bracing requirements without creating a bspline object. user code might use this information to generate coefficient arrays suitable for use with vspline evaluation code, sidestepping use of a bspline object. More...
 
static shape_type get_right_brace_size (int spline_degree, bcv_type bcv)
 
static shape_type get_container_shape (int spline_degree, bcv_type bcv, shape_type core_shape, int headroom)
 convenience method to caculate the shape of a container array needed to hold the coefficients of a spline with the given properties. The arguments are the same as those passed to the bspline object's constructor, but this method is static, so it can be called on the spline's type and does not need an object. I'm including this to make it easier for code which creates the container array externally before constructing the bspline object, rather than relying on class bspline to allocate it's own storage. More...
 
template<typename = std::enable_if < _dimension == 1 >>
static long get_container_shape (int spline_degree, vspline::bc_code bc, long core_shape, int headroom)
 variant for 1D splines. This variant accepts the shape as a plain long, rather than requiring a TinyVector of one long. More...
 

Public Attributes

view_type container
 
view_type core
 
bool prefiltered
 boolean flag indicating whether the coefficients were prefiltered or not. This must be taken with a grain of salt - it's up to the user to decide whether this flag can be trusted. vspline code will set it whenever 'prefilter' is called, but since both this flag and the coefficients themselves are open to manipulation, external code performing such manipulations can decide to ignore the flag. Initially, the flag is set to 'false', and vspline does not perform prefiltering automatically, so it will remain false until prefilter is called or until the user 'manually' sets it to true. More...
 
int spline_degree
 
const shape_type core_shape
 
const shape_type container_shape
 
const shape_type left_frame
 
const shape_type right_frame
 
const xlf_type tolerance
 
const bcv_type bcv
 
- Public Attributes inherited from vspline::bspline_base< _dimension >
const bcv_type bcv
 
const xlf_type tolerance
 
const shape_type left_frame
 
const shape_type core_shape
 
const shape_type right_frame
 
const shape_type container_shape
 

Friends

std::ostream & operator<< (std::ostream &osr, const bspline &bsp)
 helper function to pretty-print a bspline object to an ostream More...
 

Detailed Description

template<class _value_type, unsigned int _dimension>
struct vspline::bspline< _value_type, _dimension >

class bspline now builds on class bspline_base, adding coefficient storage, while bspline_base provides metadata handling. This separation makes it easier to generate classes which use the same metadata scheme. One concrete example is a class to type-erase a spline (not yet part of the library) which abstracts a spline, hiding the type of it's coefficients. Such a class can inherit from bspline_base and initialize the base class in the c'tor from a given bspline object, resulting in a uniform interface to the metadata. class bspline takes an additional template argument: the value type. This is the type of the coefficients stored in the spline, and it will typically be a single fundamental type or a small aggregate - like a vigra::TinyVector. vspline uses vigra's ExpandElementResult mechanism to inquire for a value type's elementary type and size, which makes it easy to adapt to new value types because the mechanism is traits-based.

Definition at line 497 of file bspline.h.

Member Typedef Documentation

◆ array_type

template<class _value_type , unsigned int _dimension>
typedef vigra::MultiArray< dimension , value_type > vspline::bspline< _value_type, _dimension >::array_type

if the coefficients are owned, an array of this type holds the data:

Definition at line 535 of file bspline.h.

◆ base_type

template<class _value_type , unsigned int _dimension>
typedef bspline_base< _dimension > vspline::bspline< _value_type, _dimension >::base_type

Definition at line 510 of file bspline.h.

◆ bcv_type

template<class _value_type , unsigned int _dimension>
typedef vigra::TinyVector< bc_code , dimension > vspline::bspline_base< _dimension >::bcv_type

nD type for one boundary condition per axis

Definition at line 203 of file bspline.h.

◆ channel_view_type

template<class _value_type , unsigned int _dimension>
typedef bspline< ele_type , dimension > vspline::bspline< _value_type, _dimension >::channel_view_type

Definition at line 545 of file bspline.h.

◆ ele_type

template<class _value_type , unsigned int _dimension>
typedef ExpandElementResult<value_type>::type vspline::bspline< _value_type, _dimension >::ele_type

elementary type of value_type, like float or double

Definition at line 508 of file bspline.h.

◆ shape_type

template<class _value_type , unsigned int _dimension>
typedef vigra::TinyVector< std::ptrdiff_t , dimension > vspline::bspline_base< _dimension >::shape_type

type of a multidimensional index type

Definition at line 199 of file bspline.h.

◆ spline_type

template<class _value_type , unsigned int _dimension>
typedef bspline< value_type , dimension > vspline::bspline< _value_type, _dimension >::spline_type

the type of 'this' bspline and of a 'channel view'

Definition at line 543 of file bspline.h.

◆ value_type

template<class _value_type , unsigned int _dimension>
typedef _value_type vspline::bspline< _value_type, _dimension >::value_type

Definition at line 500 of file bspline.h.

◆ view_type

template<class _value_type , unsigned int _dimension>
typedef vigra::MultiArrayView< dimension , value_type > vspline::bspline< _value_type, _dimension >::view_type

data are read and written to vigra MultiArrayViews:

Definition at line 539 of file bspline.h.

Member Enumeration Documentation

◆ anonymous enum

template<class _value_type , unsigned int _dimension>
anonymous enum

number of channels in value_type

Enumerator
channels 

Definition at line 504 of file bspline.h.

Constructor & Destructor Documentation

◆ bspline() [1/2]

template<class _value_type , unsigned int _dimension>
vspline::bspline< _value_type, _dimension >::bspline ( shape_type  _core_shape,
int  _spline_degree = 3,
bcv_type  _bcv = bcv_type ( MIRROR ),
xlf_type  _tolerance = -1.0,
int  headroom = 0,
view_type  _space = view_type() 
)
inline

construct a bspline object with appropriate storage space to contain and process an array of knot point data with shape _core_shape. Depending on the the other parameters passed, more space than _core_shape may be allocated. Once the bspline object is ready, usually it is filled with the knot point data and then the prefiltering needs to be done. This sequence assures that the knot point data are present in memory only once, the prefiltering is done in-place. So the user can create the bspline, fill in data (like, from a file), prefilter, and then evaluate.

alternatively, if the knot point data are already manifest elsewhere, they can be passed to prefilter(). With this mode of operation, they are 'pulled in' during prefiltering.

It's possible to pass in a view to an array providing space for the coefficients, or even the coefficients themselves. This is done via the parameter _space. This has to be an array of the same or larger shape than the container array would end up having given all the other parameters. This view is then 'adopted' and subsequent processing will operate on it's data.

The additional parameter 'headroom' is used to make the 'frame' even wider. This is needed if the spline is to be 'shifted' up (evaluated as if it had been prefiltered with a higher-degree prefilter) - see shift(). The headroom goes on top of the brace.

While bspline objects allow very specific parametrization, most use cases won't use parameters beyond the first few. The only mandatory parameter is, obviously, the shape of the knot point data, the original data which the spline is built over. This shape 'returns' as the bspline object's 'core' shape. If this is the only parameter passed to the constructor, the resulting bspline object will be a cubic b-spline with mirror boundary conditions, allocating it's own storage for the coefficients.

Note that passing tolerance = 0.0 may increase prefiltering time significantly, especially when prefiltering 1D splines, which can't use multithreaded and vectorized code in this case. Really, tolerance 0 doesn't produce significantly better results than the default, which is a very low value already. The tolerance 0 code is there more for completeness' sake, as it actually produces the result of the prefilter using the formula to calculate the initial causal and anticausal coefficient precisely, whereas the small tolerance used by default is so small that it roughly mirrors the arithmetic precision which can be achieved with the given type, which leads to nearly the same initial coefficients. Oftentimes even the default is too conservative - a 'reasonable' value is in the order of magnitude of the noise in the signal you're processing. But using the default won't slow things down a great deal, since it only results in the initial coefficients being calculated a bit less quickly. With nD data, tolerance 0 is less of a problem because the operation will still be multithreaded and vectorized.

Definition at line 634 of file bspline.h.

◆ bspline() [2/2]

template<class _value_type , unsigned int _dimension>
template<typename = std::enable_if < _dimension == 1 >>
vspline::bspline< _value_type, _dimension >::bspline ( long  _core_shape,
int  _spline_degree = 3,
bc_code  _bc = MIRROR,
xlf_type  _tolerance = -1.0,
int  headroom = 0,
view_type  _space = view_type() 
)
inline

overloaded constructor for 1D splines. This is useful because if we don't provide it, the caller would have to pass TinyVector < T , 1 > instead of T for the shape and the boundary condition.

Definition at line 709 of file bspline.h.

Member Function Documentation

◆ brace()

template<class _value_type , unsigned int _dimension>
void vspline::bspline< _value_type, _dimension >::brace ( int  axis = -1)
inline

if the spline coefficients are already known, they obviously don't need to be prefiltered. But in order to be used by vspline's evaluation code, they need to be 'braced' - the 'core' coefficients have to be surrounded by more coeffcients covering the support the evaluator needs to operate without bounds checking inside the spline's defined range. brace() performs this operation. brace() assumes the bspline object has been set up with the desired initial parameters, so that the boundary conditions and metrics are already known and storage is available. brace() can be called for a specific axis, or for the whole container by passing -1. User code will only need to call 'brace' explicitly if the coefficients were modified 'from the outside' - when 'prefilter' is called, 'brace' is called automatically.

Parameters
axisspecific axis, -1: all

Definition at line 773 of file bspline.h.

◆ get_channel_view()

template<class _value_type , unsigned int _dimension>
channel_view_type vspline::bspline< _value_type, _dimension >::get_channel_view ( const int &  channel)
inline

get a bspline object for a single channel of the data. This is lightweight and requires the viewed data to remain present as long as the channel view is used. the channel view inherits all metrics from it's parent, only the MultiArrayViews to the data are different.

Definition at line 730 of file bspline.h.

◆ get_container_shape() [1/2]

template<class _value_type , unsigned int _dimension>
static shape_type vspline::bspline_base< _dimension >::get_container_shape ( int  spline_degree,
bcv_type  bcv,
shape_type  core_shape,
int  headroom 
)
inlinestatic

convenience method to caculate the shape of a container array needed to hold the coefficients of a spline with the given properties. The arguments are the same as those passed to the bspline object's constructor, but this method is static, so it can be called on the spline's type and does not need an object. I'm including this to make it easier for code which creates the container array externally before constructing the bspline object, rather than relying on class bspline to allocate it's own storage.

Definition at line 420 of file bspline.h.

◆ get_container_shape() [2/2]

template<class _value_type , unsigned int _dimension>
template<typename = std::enable_if < _dimension == 1 >>
static long vspline::bspline_base< _dimension >::get_container_shape ( int  spline_degree,
vspline::bc_code  bc,
long  core_shape,
int  headroom 
)
inlinestatic

variant for 1D splines. This variant accepts the shape as a plain long, rather than requiring a TinyVector of one long.

Definition at line 441 of file bspline.h.

◆ get_left_brace_size()

template<class _value_type , unsigned int _dimension>
static shape_type vspline::bspline_base< _dimension >::get_left_brace_size ( int  spline_degree,
bcv_type  bcv 
)
inlinestatic

get_left_brace_size and get_right_brace_size calculate the size of the brace vspline puts around the 'core' coefficients to allow evaluation inside the defined range (and even slightly beyond) without bounds checking. These routines are static to allow user code to establish vspline's bracing requirements without creating a bspline object. user code might use this information to generate coefficient arrays suitable for use with vspline evaluation code, sidestepping use of a bspline object.

Definition at line 297 of file bspline.h.

◆ get_right_brace_size()

template<class _value_type , unsigned int _dimension>
static shape_type vspline::bspline_base< _dimension >::get_right_brace_size ( int  spline_degree,
bcv_type  bcv 
)
inlinestatic

Definition at line 347 of file bspline.h.

◆ lower_limit() [1/3]

template<class _value_type , unsigned int _dimension>
limit_type vspline::bspline_base< _dimension >::lower_limit ( ) const
inline

Definition at line 241 of file bspline.h.

◆ lower_limit() [2/3]

template<class _value_type , unsigned int _dimension>
static xlf_type vspline::bspline_base< _dimension >::lower_limit ( const bc_code bc)
inlinestatic

lower_limit returns the lower bound of the spline's defined range. This is usually 0.0, but with REFLECT boundary condition it's -0.5, the lower point of reflection. The lowest coordinate at which the spline can be accessed may be lower: even splines have wider support, and splines with extra headroom add even more room to manoevre.

Definition at line 226 of file bspline.h.

◆ lower_limit() [3/3]

template<class _value_type , unsigned int _dimension>
xlf_type vspline::bspline_base< _dimension >::lower_limit ( const int &  axis) const
inline

Definition at line 236 of file bspline.h.

◆ prefilter() [1/2]

template<class _value_type , unsigned int _dimension>
template<typename T , typename math_ele_type = typename vigra::NumericTraits < typename vigra::PromoteTraits < ele_type , ET<T> > :: Promote > :: RealPromote, size_t vsize = vspline::vector_traits<math_ele_type>::size>
void vspline::bspline< _value_type, _dimension >::prefilter ( const vigra::MultiArrayView< dimension, T > &  data,
vspline::xlf_type  boost = vspline::xlf_type ( 1 ),
int  njobs = vspline::default_njobs 
)
inline

If data are passed in, they have to have precisely the shape we have set up in core (_core_shape passed into the constructor). These data will then be used in place of any data present in the bspline object to calculate the coefficients. They won't be looked at after prefilter() terminates, so it's safe to pass in a MultiArrayView which is destroyed after the call to prefilter() returns. Any data residing in the bspline object's memory will be overwritten. here, the default math_ele_type ensures that math_ele_type is appropriate for both T and ele_type.

Definition at line 859 of file bspline.h.

◆ prefilter() [2/2]

template<class _value_type , unsigned int _dimension>
template<class math_ele_type = typename vigra::NumericTraits < ele_type > :: RealPromote, size_t vsize = vspline::vector_traits<math_ele_type>::size>
void vspline::bspline< _value_type, _dimension >::prefilter ( vspline::xlf_type  boost = vspline::xlf_type ( 1 ),
int  njobs = vspline::default_njobs 
)
inline

prefilter converts the knot point data in the 'core' area into b-spline coefficients. Bracing/framing will be applied. Even if the degree of the spline is zero or one, prefilter() can be called because it also performs the bracing. the arithmetic of the prefilter is performed in 'math_ele_type', which defaults to the vigra RealPromoted elementary type of the spline's value_type. This default ensures that integral knot point data are handled appropriately and prefiltering them will only suffer from quantization errors, which may be acceptable if the dynamic range is sufficiently large. 'boost' is an additional factor which will be used to amplify the incoming signal. This is intended for cases where the range of the signal has to be widened to fill the dynamic range of the signal's data type (specifically if it is an integral type). User code has to deal with the effects of boosting the signal, the bspline object holds no record of the 'boost' being applied. When evaluating a spline with boosted coefficients, user code will have to provide code to attenuate the resulting signal back into the original range; for an easy way of doing so, see vspline::amplify_type, which is a type derived from vspline::unary_functor providing multiplication with a factor. There is an example of it's application in the context of an integer-valued spline in int_spline.cc.

Definition at line 815 of file bspline.h.

◆ shift()

template<class _value_type , unsigned int _dimension>
bool vspline::bspline< _value_type, _dimension >::shift ( int  d)
inline

shift() actually changes the interpretation of the data. The data will be taken to be coefficients of a spline with degree spline_degree + d, and the original degree is lost. This operation is only performed if it is technically safe (see shiftable()). If the shift was performed successfully, this function returns true, false otherwise. Note that, rather than 'shifting' the b-spline object, it's also possible to use a 'shifted' evaluator to produce the same result. See class evaluator's constructor.

Definition at line 953 of file bspline.h.

◆ shiftable()

template<class _value_type , unsigned int _dimension>
bool vspline::bspline< _value_type, _dimension >::shiftable ( int  d) const
inline

'shift' will change the interpretation of the data in a bspline object. d is taken as a difference to add to the current spline degree. Coefficients remain the same, but creating an evaluator from the shifted spline will make the evaluator produce data as if the coefficients were those of a spline of the changed order. Shifting with positive d will efectively blur the interpolated signal, shifting with negative d will sharpen it. For shifting to work, the spline has to have enough 'headroom', meaning that spline_degree + d, the new spline degree, has to be greater or equal to 0 and smaller than the largest supported spline degree (lower fourties) - and, additionally, there has to be a wide-enough brace to allow evaluation with the wider kernel of the higher-degree spline's reconstruction filter. So if a spline is set up with degree 0 and shifted to degree 5, it has to be constructed with an additional headroom of 3 (see the constructor).

shiftable() is called with a desired change of spline_degree. If it returns true, interpreting the data in the container array as coefficients of a spline with the changed degree is safe. If not, the frame size is not sufficient or the resulting degree is invalid and shiftable() returns false. Note how the decision is merely technical: if the new degree is okay and the frame is large enough, the shift will be considered permissible.

Definition at line 926 of file bspline.h.

◆ upper_limit() [1/3]

template<class _value_type , unsigned int _dimension>
limit_type vspline::bspline_base< _dimension >::upper_limit ( ) const
inline

Definition at line 280 of file bspline.h.

◆ upper_limit() [2/3]

template<class _value_type , unsigned int _dimension>
xlf_type vspline::bspline_base< _dimension >::upper_limit ( const int &  axis) const
inline

Definition at line 268 of file bspline.h.

◆ upper_limit() [3/3]

template<class _value_type , unsigned int _dimension>
static xlf_type vspline::bspline_base< _dimension >::upper_limit ( const std::size_t &  extent,
const bc_code bc 
)
inlinestatic

upper_limit returns the upper bound of the spline's defined range. This is normally M - 1 if the shape for this axis is M. Splines with REFLECT boundary condition use M - 0.5, the upper point of reflection, and periodic splines use M. The highest coordinate at which the spline may be accessed safely may be higher.

Definition at line 255 of file bspline.h.

Friends And Related Function Documentation

◆ operator<<

template<class _value_type , unsigned int _dimension>
std::ostream & operator<< ( std::ostream &  osr,
const bspline< _value_type, _dimension > &  bsp 
)
friend

helper function to pretty-print a bspline object to an ostream

Definition at line 965 of file bspline.h.

Member Data Documentation

◆ bcv

template<class _value_type , unsigned int _dimension>
const bcv_type vspline::bspline_base< _dimension >::bcv

Definition at line 212 of file bspline.h.

◆ container

template<class _value_type , unsigned int _dimension>
view_type vspline::bspline< _value_type, _dimension >::container

Definition at line 565 of file bspline.h.

◆ container_shape

template<class _value_type , unsigned int _dimension>
const shape_type vspline::bspline_base< _dimension >::container_shape

Definition at line 218 of file bspline.h.

◆ core

template<class _value_type , unsigned int _dimension>
view_type vspline::bspline< _value_type, _dimension >::core

Definition at line 566 of file bspline.h.

◆ core_shape

template<class _value_type , unsigned int _dimension>
const shape_type vspline::bspline_base< _dimension >::core_shape

Definition at line 216 of file bspline.h.

◆ left_frame

template<class _value_type , unsigned int _dimension>
const shape_type vspline::bspline_base< _dimension >::left_frame

Definition at line 215 of file bspline.h.

◆ prefiltered

template<class _value_type , unsigned int _dimension>
bool vspline::bspline< _value_type, _dimension >::prefiltered

boolean flag indicating whether the coefficients were prefiltered or not. This must be taken with a grain of salt - it's up to the user to decide whether this flag can be trusted. vspline code will set it whenever 'prefilter' is called, but since both this flag and the coefficients themselves are open to manipulation, external code performing such manipulations can decide to ignore the flag. Initially, the flag is set to 'false', and vspline does not perform prefiltering automatically, so it will remain false until prefilter is called or until the user 'manually' sets it to true.

Definition at line 578 of file bspline.h.

◆ right_frame

template<class _value_type , unsigned int _dimension>
const shape_type vspline::bspline_base< _dimension >::right_frame

Definition at line 217 of file bspline.h.

◆ spline_degree

template<class _value_type , unsigned int _dimension>
int vspline::bspline< _value_type, _dimension >::spline_degree

Definition at line 588 of file bspline.h.

◆ tolerance

template<class _value_type , unsigned int _dimension>
const xlf_type vspline::bspline_base< _dimension >::tolerance

Definition at line 213 of file bspline.h.


The documentation for this struct was generated from the following file: