SigmaTransform
The SigmaTransform unifies various known signal processing transforms, like the STFT and the wavelet transform, differing only by a specific diffeomorphism.
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SigmaTransform::SigmaTransform2D Class Reference

#include <SigmaTransform2D.h>

Inheritance diagram for SigmaTransform::SigmaTransform2D:
SigmaTransform::SigmaTransform< 2 >

Public Member Functions

 SigmaTransform2D (diffFunc< 2 > sigma=NULL, winFunc< 2 > window=NULL, const point< 2 > &Fs=point< 2 >(0), const point< 2 > &size=point< 2 >(0), const std::vector< point< 2 >> &steps=std::vector< point< 2 >>(0), actFunc< 2 > act=minus< 2 >)
 SigmaTransform2D (diffFunc< 2 > sigma=NULL, const point< 2 > &width=0, const point< 2 > &Fs=point< 2 >(0), const point< 2 > &size=point< 2 >(0), const std::vector< point< 2 >> &steps=std::vector< point< 2 >>(0), actFunc< 2 > act=minus< 2 >)
SigmaTransformsetWindow (winFunc< N > window)
SigmaTransformsetSigma (diffFunc< N > sigma)
SigmaTransformsetAction (actFunc< N > action)
SigmaTransformsetFs (const point< N > &Fs)
SigmaTransformsetSize (const point< N > &size)
SigmaTransformsetWinWidth (const double &winWidth)
SigmaTransformsetNumThreads (const int &numThreads)
SigmaTransformsetSteps (const std::vector< point< N >> &steps)
cxVec & getCoeffs ()
cxVec & getWindows ()
cxVec & getReconstruction ()
SigmaTransformoperator() (cxVec const &sig)
SigmaTransformanalyze (cxVec const &sig, std::function< void(SigmaTransform *)> onFinish=NULL)
SigmaTransformsynthesize (std::function< void(SigmaTransform *obj)> onFinish=NULL)
cxVec & multiplier (cxVec const &sig, cxVec const &mask, std::function< void(SigmaTransform *)> onFinish=NULL)
cxVec & multiplier (cxVec const &sig, mskFunc< N > maskFunc, std::function< void(SigmaTransform *)> onFinish=NULL)
SigmaTransformapplyMask (const cxVec &mask)
SigmaTransformapplyMask (mskFunc< N > maskFunc)
void makeWindows ()
SigmaTransformasyncTransform (cxVec const &sig, std::function< void(SigmaTransform *)> onFinish)
SigmaTransformasyncInverseTransform (std::function< void(SigmaTransform *)> onFinish)
SigmaTransformasyncMultiplier (cxVec const &sig, cxVec const &mask, std::function< void(SigmaTransform *)> onFinish)
SigmaTransformasyncMultiplier (cxVec const &sig, mskFunc< N > maskFunc, std::function< void(SigmaTransform *)> onFinish)
SigmaTransformjoin ()
cxVec fft (cxVec const &in, int const &howmany=1)
void fft_inplace (cxVec &inout, int const &howmany=1)
cxVec ifft (cxVec const &in, int const &howmany=1)
void ifft_inplace (cxVec &inout, int const &howmany=1)

Protected Member Functions

void makeWarpedDomain ()
std::vector< point< N > > makeSpatialDomain ()
void makeWarpedGaussian ()
SigmaTransformapplyTransform (const cxVec &in)
SigmaTransformapplyInverseTransform ()
void fftN (fftw_complex *out, fftw_complex *in, const point< N > &size, const int &howmany=1, const int &DIR=FFTW_FORWARD)

Protected Attributes

std::function< cmpx(point< N >
const &)> 
m_window
std::function< point< N >point
< N >const &)> 
m_sigma
std::function< point< N >point
< N >const &, point< N >const &)> 
m_action
cxVec m_windows
cxVec m_coeff
cxVec m_reconstructed
point< N > m_size
point< N > m_fs
std::vector< point< N > > m_steps
std::vector< point< N > > m_domain
int m_numThreads
point< N > m_winWidth
std::map< std::string,
std::thread > 
m_threads
std::mutex m_mtx

Detailed Description

Class SigmaTransform2D is a two-dimensional instantation of SigmaTransform<N> and can thus, since no more templates are involved, be used in a precompiled form.

See the documentation of SigmaTransform<N> for more information.

Definition at line 36 of file SigmaTransform2D.h.

Constructor & Destructor Documentation

SigmaTransform::SigmaTransform2D::SigmaTransform2D ( diffFunc< 2 >  sigma = NULL,
winFunc< 2 >  window = NULL,
const point< 2 > &  Fs = point<2>(0),
const point< 2 > &  size = point<2>(0),
const std::vector< point< 2 >> &  steps = std::vector<point<2>>(0),
actFunc< 2 >  act = minus<2> 
)

Definition at line 21 of file SigmaTransform2D.cpp.

SigmaTransform::SigmaTransform2D::SigmaTransform2D ( diffFunc< 2 >  sigma = NULL,
const point< 2 > &  width = 0,
const point< 2 > &  Fs = point<2>(0),
const point< 2 > &  size = point<2>(0),
const std::vector< point< 2 >> &  steps = std::vector<point<2>>(0),
actFunc< 2 >  act = minus<2> 
)

Definition at line 25 of file SigmaTransform2D.cpp.

Member Function Documentation

SigmaTransform& SigmaTransform::SigmaTransform< N >::analyze ( cxVec const &  sig,
std::function< void(SigmaTransform< 2 > *)>  onFinish = NULL 
)
inlineinherited

Analyze a signal.

Parameters
sigthe signal as a complex vector
onFinisha callback-function to be called, when the work is done; defaults to NULL NOTE: if NOT NULL: the transform is executed asynchronously in a separate thread and the function returns immediately if NULL: the transfom is executed synchronously and blocks till finish
Returns
reference to the SigmaTransform-object
Exceptions
std::runtime_error

Definition at line 212 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::applyInverseTransform ( )
inlineprotectedinherited

Applies the actual inverse transform in a multi-threaded manner.

Returns
reference to the SigmaTransform-object

Definition at line 652 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::applyMask ( const cxVec &  mask)
inlineinherited

Multiplies the coefficients with a mask.

Parameters
maskthe mask as a complex vector (of the same size as the coefficient-vector)
Returns
reference to the SigmaTransform-object
Exceptions
std::runtime_error

Definition at line 276 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::applyMask ( mskFunc< N >  maskFunc)
inlineinherited

Multiplies the coefficients with a mask, using a given masking function.

Parameters
maskFunccomplex function handle, taking spatial and warped Fourier domain parameters
Returns
reference to the SigmaTransform-object

Definition at line 310 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::applyTransform ( const cxVec &  in)
inlineprotectedinherited

Applies the actual transform in a multi-threaded manner.

Parameters
inthe signal as a complex vector
Returns
reference to the SigmaTransform-object

Definition at line 615 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::asyncInverseTransform ( std::function< void(SigmaTransform< 2 > *)>  onFinish)
inlineinherited

Performs the synthesis/inverse transform asynchronously.

Parameters
onFinisha callback-function to be called, when the work is done
Returns
reference to the SigmaTransform-object

Definition at line 400 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::asyncMultiplier ( cxVec const &  sig,
cxVec const &  mask,
std::function< void(SigmaTransform< 2 > *)>  onFinish 
)
inlineinherited

Performs the multiplier asynchronously.

Parameters
sigsignal as a complex vector
maskcomplex mask vector of the same size as the coefficient-vector
onFinisha callback-function to be called, when the work is done
Returns
reference to the SigmaTransform-object

Definition at line 422 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::asyncMultiplier ( cxVec const &  sig,
mskFunc< N >  maskFunc,
std::function< void(SigmaTransform< 2 > *)>  onFinish 
)
inlineinherited

Performs the multiplier asynchronously.

Parameters
sigsignal as a complex vector
maskFunca function handle for the masking function
onFinisha callback-function to be called, when the work is done
Returns
reference to the SigmaTransform-object

Definition at line 444 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::asyncTransform ( cxVec const &  sig,
std::function< void(SigmaTransform< 2 > *)>  onFinish 
)
inlineinherited

Performs the analysis/transform asynchronously.

Parameters
sigsignal as a complex vector
onFinisha callback-function to be called, when the work is done
Returns
reference to the SigmaTransform-object

Definition at line 380 of file SigmaTransformN.h.

cxVec SigmaTransform::SigmaTransform< N >::fft ( cxVec const &  in,
int const &  howmany = 1 
)
inlineinherited

Forward fft - wrapper for fftN.

Parameters
incomplex input vector
howmanynumber of signals of size "size", found in the input vector
Returns
complex output vector holding the transformed data

Definition at line 492 of file SigmaTransformN.h.

void SigmaTransform::SigmaTransform< N >::fft_inplace ( cxVec &  inout,
int const &  howmany = 1 
)
inlineinherited

Forward fft for inplace transform - wrapper for fftN.

Parameters
inoutcomplex input and output vector
howmanynumber of signals of size "size", found in the input vector
Returns
void

Definition at line 510 of file SigmaTransformN.h.

void SigmaTransform::SigmaTransform< N >::fftN ( fftw_complex *  out,
fftw_complex *  in,
const point< N > &  size,
const int &  howmany = 1,
const int &  DIR = FFTW_FORWARD 
)
inlineprotectedinherited

Wrapper for the N-dimensional Fast Fourier Transform from the FFTW Lib.

Parameters
outpointer to buffer, where the complex and transformed data is to be placed
inpointer to buffer, where the complex data is stored
sizesize of the signal to be transformed
howmanynumber of signals of size "size", found in the buffer "in"
DIRdirection of the transform
Returns
reference to the SigmaTransform-object

Definition at line 685 of file SigmaTransformN.h.

cxVec& SigmaTransform::SigmaTransform< N >::getCoeffs ( )
inlineinherited

Getter method for the transform-coefficients.

Returns
reference to the transform coefficients

Definition at line 178 of file SigmaTransformN.h.

cxVec& SigmaTransform::SigmaTransform< N >::getReconstruction ( )
inlineinherited

Getter method for the reconstruction

Returns
reference to the reconstructed signal

Definition at line 190 of file SigmaTransformN.h.

cxVec& SigmaTransform::SigmaTransform< N >::getWindows ( )
inlineinherited

Getter method for the spectrum of the windows

Returns
reference to the spectrums of the used windows

Definition at line 184 of file SigmaTransformN.h.

cxVec SigmaTransform::SigmaTransform< N >::ifft ( cxVec const &  in,
int const &  howmany = 1 
)
inlineinherited

Inverse fft - wrapper for fftN.

Parameters
incomplex input vector
howmanynumber of signals of size "size", found in the input vector
Returns
complex output vector holding the transformed data

Definition at line 524 of file SigmaTransformN.h.

void SigmaTransform::SigmaTransform< N >::ifft_inplace ( cxVec &  inout,
int const &  howmany = 1 
)
inlineinherited

Inverse fft for inplace transform - wrapper for fftN.

Parameters
inoutcomplex input and output vector
howmanynumber of signals of size "size", found in the input vector
Returns
void

Definition at line 542 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::join ( )
inlineinherited

Waits for the asynchronous-threads to join and finally deltes them.

Returns
reference to the SigmaTransform-object

Definition at line 462 of file SigmaTransformN.h.

std::vector<point<N> > SigmaTransform::SigmaTransform< N >::makeSpatialDomain ( )
inlineprotectedinherited

Generates a Spatial domain, from the size and the sampling frequency

Returns
reference to the SigmaTransform-object

Definition at line 571 of file SigmaTransformN.h.

void SigmaTransform::SigmaTransform< N >::makeWarpedDomain ( )
inlineprotectedinherited

Generates a warped Fourier domain, from the spectral diffeomorphism and the sampling frequency.

Returns
reference to the SigmaTransform-object

Definition at line 555 of file SigmaTransformN.h.

void SigmaTransform::SigmaTransform< N >::makeWarpedGaussian ( )
inlineprotectedinherited

Generates a warped Gaussian window of adequate size.

Returns
reference to the SigmaTransform-object

Definition at line 585 of file SigmaTransformN.h.

void SigmaTransform::SigmaTransform< N >::makeWindows ( )
inlineinherited

Creates a set of "m_steps.size()" windows in the Fourier domain.

Returns
reference to the SigmaTransform-object

Definition at line 343 of file SigmaTransformN.h.

cxVec& SigmaTransform::SigmaTransform< N >::multiplier ( cxVec const &  sig,
cxVec const &  mask,
std::function< void(SigmaTransform< 2 > *)>  onFinish = NULL 
)
inlineinherited

Use transform as a multiplier; analyze, apply a mask and synthesize.

Parameters
sigthe signal as a complex vector
maskthe mask as a complex vector (of the same size as the coefficient-vector)
onFinisha callback-function to be called, when the work is done; defaults to NULL NOTE: if NOT NULL: the multiplier is executed asynchronously in a separate thread and the function returns immediately if NULL: the multiplier is executed synchronously and blocks till finish
Returns
reference to the SigmaTransform-object

Definition at line 249 of file SigmaTransformN.h.

cxVec& SigmaTransform::SigmaTransform< N >::multiplier ( cxVec const &  sig,
mskFunc< N >  maskFunc,
std::function< void(SigmaTransform< 2 > *)>  onFinish = NULL 
)
inlineinherited

Use transform as a multiplier; analyze, apply a mask and synthesize.

Parameters
sigthe signal as a complex vector
maskFunccomplex function handle, taking spatial and warped Fourier domain parameters
onFinisha callback-function to be called, when the work is done; defaults to NULL NOTE: if NOT NULL: the multiplier is executed asynchronously in a separate thread and the function returns immediately if NULL: the multiplier is executed synchronously and blocks till finish
Returns
reference to the SigmaTransform-object

Definition at line 264 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::operator() ( cxVec const &  sig)
inlineinherited

Functor operator, wrapping "analyze".

Parameters
sigthe signal as a complex vector
Returns
reference to the SigmaTransform-object

Definition at line 198 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::setAction ( actFunc< N >  action)
inlineinherited

Setter method for the action function handle.

Parameters
actiona function handle for the "group action" performed in the warped Fourier domain, defaults to "subtraction"
Returns
reference to the SigmaTransform-object

Definition at line 94 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::setFs ( const point< N > &  Fs)
inlineinherited

Setter method for the sampling frequency

Parameters
Fsthe sampling frequency in N dimensions
Returns
reference to the SigmaTransform-object

Definition at line 102 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::setNumThreads ( const int &  numThreads)
inlineinherited

Setter method for the number of threads

Parameters
numThreadsthe number of threads used for parallel processing (multiplications, additions as well as for FFTW), defaults to 4
Returns
reference to the SigmaTransform-object

Definition at line 126 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::setSigma ( diffFunc< N >  sigma)
inlineinherited

Setter method for the spectral diffeomorphism function handle.

Parameters
sigmaa function handle for the spectral diffeomorphism, NULL for identity (STFT in N dimensions)
Returns
reference to the SigmaTransform-object

Definition at line 86 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::setSize ( const point< N > &  size)
inlineinherited

Setter method for the signal size

Parameters
sizethe size of the signals that are to be transformed in N dimensions
Returns
reference to the SigmaTransform-object

Definition at line 110 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::setSteps ( const std::vector< point< N >> &  steps)
inlineinherited

Setter method for the channels used in the warped Fourier domain

Parameters
stepsvector containing the channels in the warped Fourier domain in N dimensions
Returns
reference to the SigmaTransform-object
Exceptions
std::runtime_error

Definition at line 137 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::setWindow ( winFunc< N >  window)
inlineinherited

Setter method for the window function handle.

Parameters
windowa function handle for the window function, NULL for warped Gaussian
Returns
reference to the SigmaTransform-object

Definition at line 78 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::setWinWidth ( const double &  winWidth)
inlineinherited

Setter method for the window width

Parameters
winWidththe width of a warped Gaussian in N dimensions
Returns
reference to the SigmaTransform-object

Definition at line 118 of file SigmaTransformN.h.

SigmaTransform& SigmaTransform::SigmaTransform< N >::synthesize ( std::function< void(SigmaTransform< 2 > *obj)>  onFinish = NULL)
inlineinherited

synthesize from the coefficients, using the (complex conjugated) spectrum of the generated windows.

Parameters
onFinisha callback-function to be called, when the work is done; defaults to NULL NOTE: if NOT NULL: the inverse transform is executed asynchronously in a separate thread and the function returns immediately if NULL: the inverse transfom is executed synchronously and blocks till finish
Returns
reference to the SigmaTransform-object

Definition at line 234 of file SigmaTransformN.h.

Member Data Documentation

std::function<point<N>point<N>const&,point<N>const&)> SigmaTransform::SigmaTransform< N >::m_action
protectedinherited

Definition at line 699 of file SigmaTransformN.h.

cxVec SigmaTransform::SigmaTransform< N >::m_coeff
protectedinherited

Definition at line 703 of file SigmaTransformN.h.

std::vector<point<N> > SigmaTransform::SigmaTransform< N >::m_domain
protectedinherited

Definition at line 710 of file SigmaTransformN.h.

point<N> SigmaTransform::SigmaTransform< N >::m_fs
protectedinherited

Definition at line 708 of file SigmaTransformN.h.

std::mutex SigmaTransform::SigmaTransform< N >::m_mtx
protectedinherited

Definition at line 716 of file SigmaTransformN.h.

int SigmaTransform::SigmaTransform< N >::m_numThreads
protectedinherited

Definition at line 711 of file SigmaTransformN.h.

cxVec SigmaTransform::SigmaTransform< N >::m_reconstructed
protectedinherited

Definition at line 704 of file SigmaTransformN.h.

std::function<point<N>point<N>const&)> SigmaTransform::SigmaTransform< N >::m_sigma
protectedinherited

Definition at line 698 of file SigmaTransformN.h.

point<N> SigmaTransform::SigmaTransform< N >::m_size
protectedinherited

Definition at line 707 of file SigmaTransformN.h.

std::vector<point<N> > SigmaTransform::SigmaTransform< N >::m_steps
protectedinherited

Definition at line 709 of file SigmaTransformN.h.

std::map<std::string,std::thread> SigmaTransform::SigmaTransform< N >::m_threads
protectedinherited

Definition at line 715 of file SigmaTransformN.h.

std::function<cmpx(point<N>const&)> SigmaTransform::SigmaTransform< N >::m_window
protectedinherited

Definition at line 697 of file SigmaTransformN.h.

cxVec SigmaTransform::SigmaTransform< N >::m_windows
protectedinherited

Definition at line 702 of file SigmaTransformN.h.

point<N> SigmaTransform::SigmaTransform< N >::m_winWidth
protectedinherited

Definition at line 712 of file SigmaTransformN.h.


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