vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
Namespaces | Macros | Functions
general_filter.h File Reference

provides vspline's digital filtering capabilities without the b-spline-specific aspects. More...

#include "vspline.h"

Go to the source code of this file.

Namespaces

namespace  vspline
 

Macros

#define VSPLINE_GENERAL_FILTER_H
 

Functions

template<unsigned int dimension, typename in_value_type , typename out_value_type , typename math_ele_type = typename vspline::common_math_ele_type < in_value_type , out_value_type >, size_t vsize = vspline::vector_traits < math_ele_type > :: size>
void vspline::forward_backward_recursive_filter (const vigra::MultiArrayView< dimension, in_value_type > &input, vigra::MultiArrayView< dimension, out_value_type > &output, vigra::TinyVector< bc_code, static_cast< int >(dimension) > bcv, std::vector< vspline::xlf_type > pv, xlf_type tolerance=-1, xlf_type boost=xlf_type(1), int axis=-1, int njobs=default_njobs)
 forward_backward_recursive_filter applies one or more pairs of simple recursive filters to the input. Each pair consists of: More...
 
template<unsigned int dimension, typename in_value_type , typename out_value_type , typename math_ele_type = typename vspline::common_math_ele_type < in_value_type , out_value_type >, size_t vsize = vspline::vector_traits < math_ele_type > :: size>
void vspline::convolution_filter (const vigra::MultiArrayView< dimension, in_value_type > &input, vigra::MultiArrayView< dimension, out_value_type > &output, vigra::TinyVector< bc_code, static_cast< int >(dimension) > bcv, std::vector< vspline::xlf_type > kv, int headroom, int axis=-1, int njobs=default_njobs)
 convolution_filter implements convolution of the input with a fixed-size convolution kernel. Note that vspline does not follow the DSP convention of using the kernel's coefficients in reverse order. The standard is to calculate sum ( ck * u(n-k) ), vspline uses sum ( ck * u(n+k-h) ) where 'h' is the 'headroom' of the kernel - the number of coefficients which are applied 'to 'past' values, so that for for a kernel with three coefficients and headroom 1, the sum at position n would be c0 * u(n-1) + c1 * u(n) + c2 * u(n+1), and for a kernel with four coefficients and headroom 2, you'd get c0 * u(n-2) + c1 * u(n-1) + c2 * u(n) + c3 * u(n+1) If you use a 'normal' kernel in vspline, you must reverse it (unless it's symmetric, of course), and you must state the 'headroom': if your kernel is odd-sized, this will normally be half the kernel size (integer division!), producing the phase-correct result, and with an even kernel you can't get the phase right, and you have to make up your mind which way the phase should shift. The 'headroom' notation leaves you free to pick your choice. The input, output, bcv, axis and njobs parameters are as in the routine above. Here what's needed here is 'kv', a std::vector holding the filter's coefficients, and the 'headroom', usually kv.size() / 2. More...
 

Detailed Description

provides vspline's digital filtering capabilities without the b-spline-specific aspects.

The two filters offered by this header are applying 'separated' filters: If the signal is nD, a 1D kernel is applied along one or all axes of the data. This requires the filter to be 'separable', meaning that if, for example, your data is 2D, the 2D kernel to be used on the data has to be a cross product of two 1D vectors which are applied along the two axes of the data. You can't use the code given here for stuff like radial basis functions where the kernel is not separable.

vspline uses the code in filter.h for prefiltering and reconstruction. In both cases, the filters are set up for the specific use with b-splines. But the filtering code is more general, and it can be used for other filtering tasks. This header provides convenient access to the two filter types implemented in vspline:

This code is currently not used in other parts of vspline - vspline uses the code in filter.h directly.

The filtering routines will appply the same filter along all axes if -1 is passed as 'axis'. Otherwise, the filter will only be applied to the specific axis. This way filtering operations with different filters along different axes can be achieved by calling the filtering routines several times, once per axis, with per-axis arguments.

Definition in file general_filter.h.

Macro Definition Documentation

◆ VSPLINE_GENERAL_FILTER_H

#define VSPLINE_GENERAL_FILTER_H

Definition at line 349 of file general_filter.h.