52 for (
int i = 0; i < info.
chs.size(); ++i) {
58 const int nEeg = eegIdx.size();
60 qWarning() <<
"[computeElectricalDistance] Need at least 2 EEG channels, found" << nEeg;
61 return MatrixXd::Zero(nEeg, nEeg);
65 VectorXd stdDevs(nEeg);
66 for (
int i = 0; i < nEeg; ++i) {
67 const RowVectorXd row = data.row(eegIdx[i]);
68 double mean = row.mean();
69 double variance = (row.array() - mean).square().mean();
70 stdDevs(i) = std::sqrt(variance);
74 MatrixXd edist = MatrixXd::Zero(nEeg, nEeg);
75 const int nTimes =
static_cast<int>(data.cols());
77 for (
int i = 0; i < nEeg; ++i) {
78 for (
int j = i + 1; j < nEeg; ++j) {
80 RowVectorXd diff = data.row(eegIdx[i]) - data.row(eegIdx[j]);
81 double meanDiff = diff.mean();
82 double varDiff = (diff.array() - meanDiff).square().mean();
83 double stdDiff = std::sqrt(varDiff);
86 double geoMean = std::sqrt(stdDevs(i) * stdDevs(j));
87 double ed = (geoMean > 1e-30) ? stdDiff / geoMean : 0.0;
100 const MatrixXd& data,
106 for (
int i = 0; i < info.
chs.size(); ++i) {
112 const int nEeg = eegIdx.size();
113 QList<QPair<int,int>> bridged;
122 for (
int i = 0; i < nEeg; ++i) {
123 for (
int j = i + 1; j < nEeg; ++j) {
125 bridged.append(qMakePair(eegIdx[i], eegIdx[j]));
Symbolic FIFF tag, block, value, unit and channel-type constants shared across FIFFLIB.
FIFF channel descriptor record (FIFF_CH_INFO): per-channel logical/scanner numbers,...
Full FIFF measurement metadata: everything from FIFFB_MEAS / FIFFB_MEAS_INFO needed to interpret a re...
Detection of electrically bridged EEG electrodes via the Electrical Distance metric.
FIFF file I/O, in-memory data structures and high-level readers/writers.
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
DSPSHARED_EXPORT QList< QPair< int, int > > computeBridgedElectrodes(const Eigen::MatrixXd &data, const FIFFLIB::FiffInfo &info, const BridgedElectrodeParams ¶ms=BridgedElectrodeParams())
Detect bridged EEG electrodes.
DSPSHARED_EXPORT Eigen::MatrixXd computeElectricalDistance(const Eigen::MatrixXd &data, const FIFFLIB::FiffInfo &info)
Compute electrical distance matrix between EEG channels.
double dElectricalDistanceThreshold
Full FIFF measurement info: per-channel descriptors, sampling and filter setup, projectors,...