vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
Public Types | Public Member Functions | Public Attributes | List of all members
vspline::domain_type< coordinate_type, _vsize > Struct Template Reference

class domain is a coordinate transformation functor. It provides a handy way to translate an arbitrary range of incoming coordinates to an arbitrary range of outgoing coordinates. This is done with a linear translation function. if the source range is [s0,s1] and the target range is [t0,t1], the translation function s->t is: More...

#include <domain.h>

Inheritance diagram for vspline::domain_type< coordinate_type, _vsize >:
vspline::unary_functor< coordinate_type, coordinate_type, vspline::vector_traits< coordinate_type >::vsize > vspline::callable< domain_type< coordinate_type, vspline::vector_traits< coordinate_type >::vsize >, coordinate_type, coordinate_type, vspline::vector_traits< coordinate_type >::vsize > vspline::unary_functor_tag< _vsize >

Public Types

typedef vspline::unary_functor< coordinate_type, coordinate_type, _vsize > base_type
 
typedef base_type::in_ele_type rc_type
 
typedef base_type::in_nd_ele_type nd_rc_type
 
typedef vigra::TinyVector< rc_type, dim_inlimit_type
 
- Public Types inherited from vspline::unary_functor< coordinate_type, coordinate_type, vspline::vector_traits< coordinate_type >::vsize >
enum  
 
enum  
 
enum  
 
typedef coordinate_type in_type
 
typedef coordinate_type out_type
 
typedef vspline::vector_traits< coordinate_type >::ele_type in_ele_type
 
typedef vspline::vector_traits< coordinate_type >::ele_type out_ele_type
 
typedef vigra::TinyVector< in_ele_type, dim_inin_nd_ele_type
 
typedef vigra::TinyVector< out_ele_type, dim_outout_nd_ele_type
 
typedef vector_traits< coordinate_type, vsize >::ele_v in_ele_v
 a simdized type of the elementary type of result_type, which is used for coefficients and results. this is fixed via the traits class vector_traits (in vector.h). Note how we derive this type using vsize from the template argument, not what vspline::vector_traits deems appropriate for ele_type - though both numbers will be the same in most cases. More...
 
typedef vector_traits< coordinate_type, vsize >::ele_v out_ele_v
 
typedef vector_traits< coordinate_type, vsize >::nd_ele_v in_nd_ele_v
 
typedef vector_traits< coordinate_type, vsize >::nd_ele_v out_nd_ele_v
 
typedef vector_traits< coordinate_type, vsize >::type in_v
 vectorized in_type and out_type. vspline::vector_traits supplies these types so that multidimensional/multichannel data come as vigra::TinyVectors, while 'singular' data won't be made into TinyVectors of one element. More...
 
typedef vector_traits< coordinate_type, vsize >::type out_v
 
typedef vector_traits< int, vsize >::ele_v ic_v
 vsize wide vector of ints, used for gather/scatter indexes More...
 
- Public Types inherited from vspline::callable< domain_type< coordinate_type, vspline::vector_traits< coordinate_type >::vsize >, coordinate_type, coordinate_type, vspline::vector_traits< coordinate_type >::vsize >
typedef vector_traits< coordinate_type, vsize >::type cl_in_v
 
typedef vector_traits< coordinate_type, vsize >::type cl_out_v
 

Public Member Functions

 domain_type (const coordinate_type &_in_low, const coordinate_type &_in_high, const coordinate_type &_out_low, const coordinate_type &_out_high)
 constructor taking the lower and upper fix points for incoming and outgoing values. If coordinate_type is fundamental, assigning to the limit_type members produces the desired TinyVectors of one fundamental. More...
 
template<class bspl_type >
 domain_type (const bspl_type &bspl, const coordinate_type &_out_low, const coordinate_type &_out_high)
 constructor taking the fix points for outgoing values from a bspline object, and the incoming lower and upper fix points explicitly More...
 
template<class bspl_type >
 domain_type (const coordinate_type &_in_low, const coordinate_type &_in_high, const bspl_type &bspl)
 
template<class bspl_type_1 , class bspl_type_2 >
 domain_type (const bspl_type_1 &bspl_in, const bspl_type_2 &bspl_out)
 
void eval (const in_type &in, out_type &out) const
 eval for unvectorized data. we dispatch on in_type, the incoming coordinate, being a 'naked' fundamental or a TinyVector More...
 
void eval (const in_type &in, out_type &out, std::true_type) const
 eval dispatch for fundamental, 1D coordinates More...
 
void eval (const in_type &in, out_type &out, std::false_type) const
 eval dispatch for TinyVectors of fundamentals More...
 
template<class crd_type >
void eval (const crd_type &in, crd_type &out) const
 eval for vectorized data. if in_type is a 'naked' fundamental, crd_type is a 'naked' ele_v, otherwise it's a TinyVector of ele_v. So we dispatch: More...
 
template<typename = std::enable_if < ( vsize > 1 ) >>
void eval (const in_v &in, out_v &out, std::true_type) const
 eval dispatch for vectorized coordinates, 1D case More...
 
template<typename = std::enable_if < ( vsize > 1 ) >>
void eval (const in_v &in, out_v &out, std::false_type) const
 eval dispatch for vectorized coordinates, nD case. This iterates over the dimensions and performs the 1D operation for each component. More...
 
- Public Member Functions inherited from vspline::callable< domain_type< coordinate_type, vspline::vector_traits< coordinate_type >::vsize >, coordinate_type, coordinate_type, vspline::vector_traits< coordinate_type >::vsize >
coordinate_type operator() (const coordinate_type &in) const
 
coordinate_type operator() (const coordinate_type &in)
 
cl_out_v operator() (const cl_in_v &in) const
 
cl_out_v operator() (const cl_in_v &in)
 

Public Attributes

const limit_type out_low
 
const limit_type in_low
 
const limit_type out_high
 
const limit_type in_high
 
const limit_type scale
 

Additional Inherited Members

- Static Public Attributes inherited from vspline::unary_functor< coordinate_type, coordinate_type, vspline::vector_traits< coordinate_type >::vsize >
static const bool has_capped_eval
 

Detailed Description

template<typename coordinate_type, size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
struct vspline::domain_type< coordinate_type, _vsize >

class domain is a coordinate transformation functor. It provides a handy way to translate an arbitrary range of incoming coordinates to an arbitrary range of outgoing coordinates. This is done with a linear translation function. if the source range is [s0,s1] and the target range is [t0,t1], the translation function s->t is:

t = ( s - s0 ) * ( t1 - t0 ) / ( s1 - s0 ) + t0

In words: the target coordinate's distance from the target range's lower bound is proportional to the source coordinate's distance from the source range's lower bound. Note that this is not a gate function: the domain will accept any incoming value and perform the shift/scale operation on it; incoming values outside [ in_low , in_high ] will produce outgoing values outside [ out_low , out_high ].

The first constructor takes s0, s1, t0 and t1. With this functor, arbitrary mappings of the form given above can be achieved. The second constructor takes a vspline::bspline object to obtain t0 and t1. These are taken as the spline's 'true' range, depending on it's boundary conditions: for periodic splines, this is [0...M], for REFLECT Bcs it's [-0.5,M-0,5], and for 'normal' splines it's [0,M-1]. s0 and s1, the start and end of the domain's coordinate range, can be passed in and default to 0 and 1, which constitutes 'normalized' spline coordinates, where 0 is mapped to the lower end of the 'true' range and 1 to the upper.

class domain is especially useful for situations where several b-splines cover the same data in different resolution, like in image pyramids. If these different splines are all evaluated with a domain chained to the evaluator which uses a common domain range, they can all be accessed with identical coordinates, even if the spline shapes don't match isotropically. Note, though, that domain objects created with b-splines with REFLECT or PERIODIC boundary conditions won't match unless the splines have the same size because the spline's bounds won't coincide for differently sized splines. You may want to create the domain object from coordinate values in this case.

The evaluation routine in class domain_type makes sure that incoming values in [ in_low , in_high ] will never produce outgoing values outside [ out_low , out_high ]. If this guarantee is not needed, the 'raw' evaluation routine _eval can be used instead. with _eval, output may overshoot out_high slightly.

I should mention libeinspline here, which has this facility as a fixed feature in it's spline types. I decided to keep it separate and create class domain instead for those cases where the functionality is needed.

Definition at line 138 of file domain.h.

Member Typedef Documentation

◆ base_type

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
typedef vspline::unary_functor< coordinate_type , coordinate_type , _vsize > vspline::domain_type< coordinate_type, _vsize >::base_type

Definition at line 152 of file domain.h.

◆ limit_type

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
typedef vigra::TinyVector< rc_type , dim_in > vspline::domain_type< coordinate_type, _vsize >::limit_type

Definition at line 165 of file domain.h.

◆ nd_rc_type

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
typedef base_type::in_nd_ele_type vspline::domain_type< coordinate_type, _vsize >::nd_rc_type

Definition at line 164 of file domain.h.

◆ rc_type

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
typedef base_type::in_ele_type vspline::domain_type< coordinate_type, _vsize >::rc_type

Definition at line 163 of file domain.h.

Constructor & Destructor Documentation

◆ domain_type() [1/4]

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
vspline::domain_type< coordinate_type, _vsize >::domain_type ( const coordinate_type _in_low,
const coordinate_type _in_high,
const coordinate_type _out_low,
const coordinate_type _out_high 
)
inline

constructor taking the lower and upper fix points for incoming and outgoing values. If coordinate_type is fundamental, assigning to the limit_type members produces the desired TinyVectors of one fundamental.

Definition at line 178 of file domain.h.

◆ domain_type() [2/4]

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
template<class bspl_type >
vspline::domain_type< coordinate_type, _vsize >::domain_type ( const bspl_type &  bspl,
const coordinate_type _out_low,
const coordinate_type _out_high 
)
inline

constructor taking the fix points for outgoing values from a bspline object, and the incoming lower and upper fix points explicitly

Definition at line 201 of file domain.h.

◆ domain_type() [3/4]

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
template<class bspl_type >
vspline::domain_type< coordinate_type, _vsize >::domain_type ( const coordinate_type _in_low,
const coordinate_type _in_high,
const bspl_type &  bspl 
)
inline

Definition at line 213 of file domain.h.

◆ domain_type() [4/4]

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
template<class bspl_type_1 , class bspl_type_2 >
vspline::domain_type< coordinate_type, _vsize >::domain_type ( const bspl_type_1 &  bspl_in,
const bspl_type_2 &  bspl_out 
)
inline

Definition at line 225 of file domain.h.

Member Function Documentation

◆ eval() [1/6]

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
template<class crd_type >
void vspline::domain_type< coordinate_type, _vsize >::eval ( const crd_type &  in,
crd_type &  out 
) const
inline

eval for vectorized data. if in_type is a 'naked' fundamental, crd_type is a 'naked' ele_v, otherwise it's a TinyVector of ele_v. So we dispatch:

Definition at line 314 of file domain.h.

◆ eval() [2/6]

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
void vspline::domain_type< coordinate_type, _vsize >::eval ( const in_type in,
out_type out 
) const
inline

eval for unvectorized data. we dispatch on in_type, the incoming coordinate, being a 'naked' fundamental or a TinyVector

Definition at line 273 of file domain.h.

◆ eval() [3/6]

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
void vspline::domain_type< coordinate_type, _vsize >::eval ( const in_type in,
out_type out,
std::false_type   
) const
inline

eval dispatch for TinyVectors of fundamentals

  • unvectorized nD cordinates

Definition at line 295 of file domain.h.

◆ eval() [4/6]

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
void vspline::domain_type< coordinate_type, _vsize >::eval ( const in_type in,
out_type out,
std::true_type   
) const
inline

eval dispatch for fundamental, 1D coordinates

Definition at line 281 of file domain.h.

◆ eval() [5/6]

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
template<typename = std::enable_if < ( vsize > 1 ) >>
void vspline::domain_type< coordinate_type, _vsize >::eval ( const in_v in,
out_v out,
std::false_type   
) const
inline

eval dispatch for vectorized coordinates, nD case. This iterates over the dimensions and performs the 1D operation for each component.

Definition at line 341 of file domain.h.

◆ eval() [6/6]

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
template<typename = std::enable_if < ( vsize > 1 ) >>
void vspline::domain_type< coordinate_type, _vsize >::eval ( const in_v in,
out_v out,
std::true_type   
) const
inline

eval dispatch for vectorized coordinates, 1D case

Definition at line 323 of file domain.h.

Member Data Documentation

◆ in_high

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
const limit_type vspline::domain_type< coordinate_type, _vsize >::in_high

Definition at line 170 of file domain.h.

◆ in_low

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
const limit_type vspline::domain_type< coordinate_type, _vsize >::in_low

Definition at line 170 of file domain.h.

◆ out_high

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
const limit_type vspline::domain_type< coordinate_type, _vsize >::out_high

Definition at line 170 of file domain.h.

◆ out_low

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
const limit_type vspline::domain_type< coordinate_type, _vsize >::out_low

Definition at line 170 of file domain.h.

◆ scale

template<typename coordinate_type , size_t _vsize = vspline::vector_traits<coordinate_type>::vsize>
const limit_type vspline::domain_type< coordinate_type, _vsize >::scale

Definition at line 171 of file domain.h.


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