32#include <QCoreApplication>
59 if (pFwdSensorSet !=
nullptr) {
60 initFromFwdCoilSet(pFwdSensorSet);
66void InvSensorSet::initFromFwdCoilSet(
const QSharedPointer<FWDLIB::FwdCoilSet> pFwdSensorSet)
68 m_ncoils = pFwdSensorSet->ncoil();
69 m_np = pFwdSensorSet->coils[0]->np;
70 initMatrices(m_ncoils, m_np);
73 for (
int i = 0; i < m_ncoils; i++) {
74 const FwdCoil* coil = pFwdSensorSet->coils[i].get();
75 MatrixXd matRmag = MatrixXd::Zero(m_np, 3);
76 MatrixXd matCosmag = MatrixXd::Zero(m_np, 3);
77 RowVectorXd vecW(m_np);
79 m_r0(i, 0) = coil->
r0[0];
80 m_r0(i, 1) = coil->
r0[1];
81 m_r0(i, 2) = coil->
r0[2];
83 m_ez(i, 0) = coil->
ez[0];
84 m_ez(i, 1) = coil->
ez[1];
85 m_ez(i, 2) = coil->
ez[2];
87 for (
int p = 0; p < m_np; p++) {
88 m_w(i * m_np + p) = coil->
w[p];
89 for (
int c = 0; c < 3; c++) {
90 matRmag(p, c) = coil->
rmag(p, c);
91 matCosmag(p, c) = coil->
cosmag(p, c);
95 m_cosmag.block(i * m_np, 0, m_np, 3) = matCosmag;
96 m_rmag.block(i * m_np, 0, m_np, 3) = matRmag;
98 m_tra = MatrixXd::Identity(m_ncoils, m_ncoils);
103void InvSensorSet::initMatrices(
int ncoils,
int np)
105 m_ez = MatrixXd(
ncoils, 3);
106 m_r0 = MatrixXd(
ncoils, 3);
108 m_cosmag = MatrixXd(
ncoils *
np, 3);
109 m_cosmag = MatrixXd(
ncoils *
np, 3);
118 const QString qPath = QString(QCoreApplication::applicationDirPath() +
"/../resources/general/coilDefinitions/coil_def.dat");
127 if (channelList.isEmpty()) {
130 auto pCoilMeg =
FwdCoilSet::SPtr(m_pCoilDefinitions->create_meg_coils(channelList, channelList.size(),
static_cast<int>(accuracy)).release());
FIFF channel descriptor record (FIFF_CH_INFO): per-channel logical/scanner numbers,...
Container of FwdCoil instances representing either a sensor-type template database or a concrete per-...
Compact MEG sensor-geometry container (positions, orientations, integration weights) used by the HPI ...
FIFF file I/O, in-memory data structures and high-level readers/writers.
Inverse source estimation (MNE, dSPM, sLORETA, dipole fitting).
Forward modelling — BEM solver, spherical models, sensor/coil definitions and the lead-field assembly...
Eigen::Matrix< float, Eigen::Dynamic, 3, Eigen::RowMajor > cosmag
Eigen::Matrix< float, Eigen::Dynamic, 3, Eigen::RowMajor > rmag
static FwdCoilSet::UPtr read_coil_defs(const QString &name)
QSharedPointer< FwdCoilSet > SPtr
Stores MEG sensor geometry (positions, orientations, weights, coil count) for a single sensor type.
InvSensorSet updateSensorSet(const QList< FIFFLIB::FiffChInfo > &channelList, const Accuracy &accuracy)