MNE-CPP  0.1.9
A Framework for Electrophysiology
Public Types | Public Member Functions | Static Public Member Functions | List of all members
DISP3DLIB::Interpolation Class Reference

This class holds methods for creating distance-based weight matrices and for interpolating signals. More...

#include <interpolation.h>

Public Types

typedef QSharedPointer< InterpolationSPtr
 
typedef QSharedPointer< const InterpolationConstSPtr
 

Public Member Functions

 Interpolation ()=delete
 

Static Public Member Functions

static QSharedPointer< Eigen::SparseMatrix< float > > createInterpolationMat (const QVector< int > &vecProjectedSensors, const QSharedPointer< Eigen::MatrixXd > matDistanceTable, double(*interpolationFunction)(double), const double dCancelDist=FLOAT_INFINITY, const QVector< int > &vecExcludeIndex=QVector< int >())
 
static Eigen::VectorXf interpolateSignal (const QSharedPointer< Eigen::SparseMatrix< float > > matInterpolationMatrix, const QSharedPointer< Eigen::VectorXf > &vecMeasurementData)
 
static Eigen::VectorXf interpolateSignal (const Eigen::SparseMatrix< float > &matInterpolationMatrix, const Eigen::VectorXf &vecMeasurementData)
 
static double linear (const double dIn)
 
static double gaussian (const double dIn)
 
static double square (const double dIn)
 
static double cubic (const double dIn)
 

Detailed Description

This class holds methods for creating distance-based weight matrices and for interpolating signals.

Calculates and stores a matrix which provides the information how much each vertex is influenced by every sensor. On this basis, the user can use sensor data to calculate interpolated values for each sensor of the mesh. The user can choose the function that is used in the interpolation. Three functions are provided. Interpolation weights are calculated using the following formula:

weight matrix

where w are interpolation weights, d are distances, m is the number of columsn and f is the used function.

Definition at line 88 of file interpolation.h.

Member Typedef Documentation

◆ ConstSPtr

typedef QSharedPointer<const Interpolation> DISP3DLIB::Interpolation::ConstSPtr

Const shared pointer type for Interpolation.

Definition at line 93 of file interpolation.h.

◆ SPtr

Shared pointer type for Interpolation.

Definition at line 92 of file interpolation.h.

Constructor & Destructor Documentation

◆ Interpolation()

DISP3DLIB::Interpolation::Interpolation ( )
delete

Deleted default constructor (static class).

Member Function Documentation

◆ createInterpolationMat()

QSharedPointer< SparseMatrix< float > > Interpolation::createInterpolationMat ( const QVector< int > &  vecProjectedSensors,
const QSharedPointer< Eigen::MatrixXd >  matDistanceTable,
double(*)(double)  interpolationFunction,
const double  dCancelDist = FLOAT_INFINITY,
const QVector< int > &  vecExcludeIndex = QVector<int>() 
)
static

This method calculates the weight matrix that is later needed for the interpolation of signals. The matrix will have n rows, where n is the number of rows of the passed distance table (i.e. the number of vertices of the mesh that the table is based on), and m columns, where m is the number of mapped sensors on the mesh (based on a prior sensor-to-mesh mapping). createInterplationMat calculates the matrix according to the following scheme:

  1. if the vertex belongs to a sensor: The value at the position of the sensor is 1 and all other values in this row are set to 0
  2. if not: the values are calculated to give a total of 1 (a lot of values will stay 0, because they are too far away to influence) by using the above mentioned formula
Parameters
[in]vecProjectedSensorsVector of IDs of sensor vertices.
[in]matDistanceTableMatrix that contains all needed distances.
[in]interpolationFunctionFunction that computes interpolation coefficients using the distance values.
[in]dCancelDistDistances higher than this are ignored, i.e. the respective coefficients are set to zero.
[in]vecExcludeIndexThe indices to be excluded from vecProjectedSensors, e.g., bad channels (empty by default).
Returns
The distance matrix created.

Definition at line 71 of file interpolation.cpp.

◆ cubic()

double Interpolation::cubic ( const double  dIn)
static

Calculates interpolation weights based on distance values. Returns interpolation weight that corresponds to cubic hyperbel.

Parameters
[in]dInDistance value.
Returns
The function value of the cubic hyperbel at d.

Definition at line 191 of file interpolation.cpp.

◆ gaussian()

double Interpolation::gaussian ( const double  dIn)
static

Calculates interpolation weights based on distance values. Returns interpolation weight that corresponds to gauss curve with sigma set to 1.

Parameters
[in]dInDistance value.
Returns
The function value of the gauss curve at d.

Definition at line 177 of file interpolation.cpp.

◆ interpolateSignal() [1/2]

static Eigen::VectorXf DISP3DLIB::Interpolation::interpolateSignal ( const QSharedPointer< Eigen::SparseMatrix< float > >  matInterpolationMatrix,
const QSharedPointer< Eigen::VectorXf > &  vecMeasurementData 
)
static

The interpolation essentially corresponds to a matrix * vector multiplication. A vector of sensor data (i.e. a vector of double-values) is multiplied with the result of the createInterpolationMat. The result is a vector that contains interpolated values for all vertices of the mesh that was used to create the weight matrix, i.e. in first instance the distance table that the weight matrix is based on.

Parameters
[in]matInterpolationMatrixThe weight matrix which should be used for multiplying.
[in]vecMeasurementDataA vector with measured sensor data.
Returns
Interpolated values for all vertices of the mesh.

◆ interpolateSignal() [2/2]

static Eigen::VectorXf DISP3DLIB::Interpolation::interpolateSignal ( const Eigen::SparseMatrix< float > &  matInterpolationMatrix,
const Eigen::VectorXf &  vecMeasurementData 
)
static

The interpolation essentially corresponds to a matrix * vector multiplication. A vector of sensor data (i.e. a vector of double-values) is multiplied with the result of the createInterpolationMat. The result is a vector that contains interpolated values for all vertices of the mesh that was used to create the weight matrix, i.e. in first instance the distance table that the weight matrix is based on.

Parameters
[in]matInterpolationMatrixThe weight matrix which should be used for multiplying.
[in]vecMeasurementDataA vector with measured sensor data.
Returns
Interpolated values for all vertices of the mesh.

◆ linear()

double Interpolation::linear ( const double  dIn)
static

Serves as a placeholder for other functions and is needed in case a linear interpolation is wanted when calling createInterplationMat.Returns input argument unchanged.

Parameters
[in]dInDistance value.
Returns
Same value interpreted as a interpolation weight.

Definition at line 170 of file interpolation.cpp.

◆ square()

double Interpolation::square ( const double  dIn)
static

Calculates interpolation weights based on distance values. Returns interpolation weight that corresponds to negative parabel with an y-offset of 1.

Parameters
[in]dInDistance value.
Returns
The function value of the negative parabel at d.

Definition at line 184 of file interpolation.cpp.


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