|
Correlation Library
1.0
|
A class that computes the cross-correlation for two continuous signals (Continuous - Continuous). More...
#include <CrossCorrelation-CC.h>
Public Member Functions | |
| CCrossCorrelationCC (int piCorrelationWindow, int piTrialLength, int &piIsError) | |
| Constructor. | |
| ~CCrossCorrelationCC () | |
| Destructor. | |
| void | ComputeCrossCorrelation (float *pfaSamplesA, int piNrSamplesInA, float *pfaSamplesB, int piNrSamplesInB, int pbNormalizeCorrelogram) |
| Compute the cross-correlation of two vectors of samples. | |
| void | ComputeWindowedCrossCorrelationPerTrial (float *pfaSamplesA, int piNrSamplesInA, float *pfaSamplesB, int piNrSamplesInB, int piFromOffsetInTrial, int piToOffsetInTrial, int pbNormalizeCorrelogram) |
| Compute the cross-correlation of two digitized continuous signals, on a partial window of the trial. ONLY ACCEPTS ONE TRIAL!!! | |
| float * | GetCrossCorrelogram () |
| Returns the buffer with the computed cross-correlogram; returns NULL if there was an error; please check the buffer for NULL before using it!! | |
| int | ModifyCorrelationWindow (int piNewCorrelationWindow) |
| Set the size of the correlation window; the parameter specifies the correlation window; for example for a window of -100..+100 pass 100 as a parameter. | |
| int | ModifyTrialLength (int piNewTrialLength) |
| Set the length of the trial in original sampling units. | |
| int | ModifyAllParameters (int piNewCorrelationWindow, int piNewTrialLength) |
| Sets all parameters at once. | |
| int | GetCorrelationWindow () |
| Get the size of the correlation window. | |
| int | GetTrialLength () |
| Get the trial length in original sampling units. | |
A class that computes the cross-correlation for two continuous signals (Continuous - Continuous).
Cross-correlation is computed in the classical way.
Two continuous signals of equal length must be provided. The signals should be digitized with the same sampling frequency.
| CCrossCorrelationCC::CCrossCorrelationCC | ( | int | piCorrelationWindow, |
| int | piTrialLength, | ||
| int & | piIsError | ||
| ) |
Constructor.
| piCorrelationWindow | - The size of the cross-correlation window (eg. 80 for a cross-correlation with laggs from -80 to +80); use the same units as the sampling of your samples |
| piTrialLength | - The size of the trial in units of your samples |
| piIsError | - A return parameter, set to 0 on success. It is set to -1 by the constructor if there is a mismatch of window sizes and the GetCrossCorrelogram() function will return NULL; |
Destructor.
| void CCrossCorrelationCC::ComputeCrossCorrelation | ( | float * | pfaSamplesA, |
| int | piNrSamplesInA, | ||
| float * | pfaSamplesB, | ||
| int | piNrSamplesInB, | ||
| int | pbNormalizeCorrelogram | ||
| ) |
Compute the cross-correlation of two vectors of samples.
If the number of samples passed is larger than the size of one trial, then the signals are divided into trials and the results are eventually averaged over trials.
| pfaSamplesA | - The vector holding the samples of the first signal |
| piNrSamplesInA | - Number of samples in the first vector |
| pfaSamplesB | - The vector holding the samples of the second signal |
| piNrSamplesInB | - Number of samples in the second vector |
| pbNormalizeCorrelogram | - Set to 1 to normalize the correlogram; normalization removes the dependency on the length of the signals and gives values in cross-product units of the continuous variables |
| void CCrossCorrelationCC::ComputeWindowedCrossCorrelationPerTrial | ( | float * | pfaSamplesA, |
| int | piNrSamplesInA, | ||
| float * | pfaSamplesB, | ||
| int | piNrSamplesInB, | ||
| int | piFromOffsetInTrial, | ||
| int | piToOffsetInTrial, | ||
| int | pbNormalizeCorrelogram | ||
| ) |
Compute the cross-correlation of two digitized continuous signals, on a partial window of the trial. ONLY ACCEPTS ONE TRIAL!!!
| pfaSamplesA | - The vector holding the samples of the first signal |
| piNrSamplesInA | - Number of samples in the first vector |
| pfaSamplesB | - The vector holding the samples of the second signal |
| piNrSamplesInB | - Number of samples in the second vector |
| piFromOffsetInTrial | - The start offset in the trial where the desired window starts |
| piToOffsetInTrial | - The end offset in the trial where the desired window stops |
| pbNormalizeCorrelogram | - Set to 1 to normalize the correlogram; normalization removes the dependency on the length of the signals and gives values in cross-product units of the continuous variables |
Get the size of the correlation window.
| float * CCrossCorrelationCC::GetCrossCorrelogram | ( | ) |
Returns the buffer with the computed cross-correlogram; returns NULL if there was an error; please check the buffer for NULL before using it!!
The size of the cross-correlogram buffer is (2*iCorrelationWindow+1), and element with lag 0 is at position iCorrelationWindow;
Get the trial length in original sampling units.
| int CCrossCorrelationCC::ModifyAllParameters | ( | int | piNewCorrelationWindow, |
| int | piNewTrialLength | ||
| ) |
Sets all parameters at once.
| piNewCorrelationWindow | - The new correlation window |
| piNewTrialLength | - The new length of the trial |
| int CCrossCorrelationCC::ModifyCorrelationWindow | ( | int | piNewCorrelationWindow | ) |
Set the size of the correlation window; the parameter specifies the correlation window; for example for a window of -100..+100 pass 100 as a parameter.
| piNewCorrelationWindow | - Specifies the new correlation window |
| int CCrossCorrelationCC::ModifyTrialLength | ( | int | piNewTrialLength | ) |
Set the length of the trial in original sampling units.
| piNewTrialLength | - The new length of the trial |