|
Correlation Library
1.0
|
A class that computes the scaled correlation for two continuous signals (Continuous - Continuous). More...
#include <ScaledCorrelation-CC.h>
Public Member Functions | |
| CScaledCorrelationCC (int piScaleWindow, int piCorrelationWindow, int piTrialLength, int &piIsError) | |
| Constructor. | |
| ~CScaledCorrelationCC () | |
| Destructor. | |
| void | ComputeScaledCorrelation (float *pfaSamplesA, int piNrSamplesInA, float *pfaSamplesB, int piNrSamplesInB, int pbUseFisherZTransform) |
| Compute the scaled correlation of two digitized continuous signals. | |
| void | ComputeWindowedScaledCorrelationPerTrial (float *pfaSamplesA, int piNrSamplesInA, float *pfaSamplesB, int piNrSamplesInB, int piFromOffsetInTrial, int piToOffsetInTrial, int pbUseFisherZTransform) |
| Compute the scaled correlation of two digitized continuous signals, on a partial window of the trial; ONLY ACCEPTS ONE TRIAL!!! | |
| float * | GetScaledCrossCorrelogram () |
| Returns the buffer with the computed scaled correlogram; returns NULL if there was an error; please check the buffer for NULL before using it!! | |
| float * | GetPearsonCoefficientSums () |
| Returns the sum of valid Pearson coefficients of correlation for each bin of the correlogram. | |
| int * | GetPearsonCoefficientCounts () |
| Returns how many Pearson's coefficients of correlation have been averaged for each bin of the scaled cross correlogram. | |
| int * | GetDistributionOfCorrelationCoefficients (int &piNumberOfBins, float &pfBinSize) |
| Returns the distribution of coefficients of correlation. | |
| int | ModifyScaleWindow (int piNewScale) |
| Changes the size of the scale segment used to compute the scaled correlation. | |
| int | ModifyCorrelationWindow (int piNewCorrelationWindow) |
| Set the size of the correlation window; the parameter specifies the correlation window; for example for lags between -100 to +100 pass 100 as a parameter. | |
| int | ModifyTrialLength (int piNewTrialLength) |
| Set the length of the trial in original sampling units. | |
| int | ModifyAllParameters (int piNewScale, int piNewCorrelationWindow, int piNewTrialLength) |
| Sets all parameters at once. | |
| int | GetScaleWindow () |
| Get the size of the current scale segment. | |
| int | GetCorrelationWindow () |
| Get the size of the correlation window. | |
| int | GetTrialLength () |
| Get the trial length in original sampling units. | |
| int | GetDistributionOfCorrelationCoefficientsBinNr () |
| Get the number of bins of the distribution of coefficients of correlation. | |
| float | GetDistributionOfCorrelationCoefficientsBinSize () |
| Get the size of a bin of the distribution of coefficients of correlation. | |
A class that computes the scaled correlation for two continuous signals (Continuous - Continuous).
For details on the Scaled Correlation algorithm see paper on "Scaled Correlation Analysis" by Danko Nikolic, Raul C. Muresan, Weijia Feng, and Wolf Singer.
Two continuous signals of equal length must be provided. The signals should be digitized with the same sampling frequency.
| CScaledCorrelationCC::CScaledCorrelationCC | ( | int | piScaleWindow, |
| int | piCorrelationWindow, | ||
| int | piTrialLength, | ||
| int & | piIsError | ||
| ) |
Constructor.
| piScaleWindow | - The scale on which you compute the scaled correlation; use the same units as the sampling unit of your signals |
| piCorrelationWindow | - The size of the cross correlation window (eg. 80 for a cross correlation with lags of -80..+80); use again the same units as the sampling of your signals |
| piTrialLength | - The size of the trial in sampling units of your signals |
| 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 GetScaledCorrelogram() function will return NULL; |
Destructor.
| void CScaledCorrelationCC::ComputeScaledCorrelation | ( | float * | pfaSamplesA, |
| int | piNrSamplesInA, | ||
| float * | pfaSamplesB, | ||
| int | piNrSamplesInB, | ||
| int | pbUseFisherZTransform | ||
| ) |
Compute the scaled correlation of two digitized continuous signals.
| pfaSamplesA | - The vector holding the first signal's input samples |
| piNrSamplesInA | - Number of samples in the first vector |
| pfaSamplesB | - The vector holding the second signal's input samples |
| piNrSamplesInB | - Number of samples in the second vector |
| pbUseFisherZTransform | - Set to 1 to use the Fisher Z transform to average the coefficients of correlation; set to 0 for normal computation; |
| void CScaledCorrelationCC::ComputeWindowedScaledCorrelationPerTrial | ( | float * | pfaSamplesA, |
| int | piNrSamplesInA, | ||
| float * | pfaSamplesB, | ||
| int | piNrSamplesInB, | ||
| int | piFromOffsetInTrial, | ||
| int | piToOffsetInTrial, | ||
| int | pbUseFisherZTransform | ||
| ) |
Compute the scaled correlation of two digitized continuous signals, on a partial window of the trial; ONLY ACCEPTS ONE TRIAL!!!
| pfaSamplesA | - The vector holding the first signal's input samples |
| piNrSamplesInA | - Number of samples in the first vector |
| pfaSamplesB | - The vector holding the second signal's input samples |
| 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 |
| pbUseFisherZTransform | - Set to 1 to use the Fisher Z transform to average the coefficients of correlation; set to 0 for normal computation; |
Get the size of the correlation window.
| int * CScaledCorrelationCC::GetDistributionOfCorrelationCoefficients | ( | int & | piNumberOfBins, |
| float & | pfBinSize | ||
| ) |
Returns the distribution of coefficients of correlation.
Get the number of bins of the distribution of coefficients of correlation.
Get the size of a bin of the distribution of coefficients of correlation.
Returns how many Pearson's coefficients of correlation have been averaged for each bin of the scaled cross correlogram.
| float * CScaledCorrelationCC::GetPearsonCoefficientSums | ( | ) |
Returns the sum of valid Pearson coefficients of correlation for each bin of the correlogram.
The size of the buffer is (2*iCorrelationWindow+1), and the sum of coefficients for lag 0 is at position iCorrelationWindow. Use this function to get the sum of all valid coefficients that were used to compute the average correlation coefficient for each bin of the ScaledCrossCorrelogram: ScaledCrossCorrelogram[i] = PearsonCoefficientSums[i] / PearsonCoefficientCounts[i].
| float * CScaledCorrelationCC::GetScaledCrossCorrelogram | ( | ) |
Returns the buffer with the computed scaled correlogram; returns NULL if there was an error; please check the buffer for NULL before using it!!
The size of the scaled correlogram buffer is (2*iCorrelationWindow+1), and element with lag 0 is at position iCorrelationWindow;
Get the size of the current scale segment.
Get the trial length in original sampling units.
| int CScaledCorrelationCC::ModifyAllParameters | ( | int | piNewScale, |
| int | piNewCorrelationWindow, | ||
| int | piNewTrialLength | ||
| ) |
Sets all parameters at once.
| piNewScale | - The new size of the scale segment |
| piNewCorrelationWindow | - The new size of the correlation window |
| piNewTrialLength | - The new length of the trial |
| int CScaledCorrelationCC::ModifyCorrelationWindow | ( | int | piNewCorrelationWindow | ) |
Set the size of the correlation window; the parameter specifies the correlation window; for example for lags between -100 to +100 pass 100 as a parameter.
| piNewCorrelationWindow | - The new size of the correlation window |
| int CScaledCorrelationCC::ModifyScaleWindow | ( | int | piNewScale | ) |
Changes the size of the scale segment used to compute the scaled correlation.
| piNewScale | - The new size of the scale segment |
| int CScaledCorrelationCC::ModifyTrialLength | ( | int | piNewTrialLength | ) |
Set the length of the trial in original sampling units.
| piNewTrialLength | - The new length of the trial |