48 #include <QCoreApplication>
54 #include <Eigen/Dense>
60 using namespace INVERSELIB;
61 using namespace FIFFLIB;
62 using namespace FWDLIB;
63 using namespace Eigen;
75 if(pFwdSensorSet!=
nullptr) {
76 initFromFwdCoilSet(pFwdSensorSet);
82 void SensorSet::initFromFwdCoilSet(
const QSharedPointer<FWDLIB::FwdCoilSet> pFwdSensorSet)
84 m_ncoils = pFwdSensorSet->ncoil;
85 m_np = pFwdSensorSet->coils[0]->np;
86 initMatrices(m_ncoils,m_np);
89 for(
int i = 0; i < m_ncoils; i++){
90 const FwdCoil* coil = (pFwdSensorSet->coils[i]);
91 MatrixXd matRmag = MatrixXd::Zero(m_np,3);
92 MatrixXd matCosmag = MatrixXd::Zero(m_np,3);
93 RowVectorXd vecW(m_np);
95 m_r0(i,0) = coil->
r0[0];
96 m_r0(i,1) = coil->
r0[1];
97 m_r0(i,2) = coil->
r0[2];
99 m_ez(i,0) = coil->
ez[0];
100 m_ez(i,1) = coil->
ez[1];
101 m_ez(i,2) = coil->
ez[2];
103 for (
int p = 0; p < m_np; p++){
104 m_w(i*m_np+p) = coil->
w[p];
105 for (
int c = 0; c < 3; c++) {
106 matRmag(p,c) = coil->
rmag[p][c];
107 matCosmag(p,c) = coil->
cosmag[p][c];
111 m_cosmag.block(i*m_np,0,m_np,3) = matCosmag;
112 m_rmag.block(i*m_np,0,m_np,3) = matRmag;
114 m_tra = MatrixXd::Identity(m_ncoils,m_ncoils);
119 void SensorSet::initMatrices(
int ncoils,
int np)
121 m_ez = MatrixXd(ncoils,3);
122 m_r0 = MatrixXd(ncoils,3);
123 m_rmag = MatrixXd(ncoils*np,3);
124 m_cosmag = MatrixXd(ncoils*np,3);
125 m_cosmag = MatrixXd(ncoils*np,3);
126 m_tra = MatrixXd(ncoils,ncoils);
127 m_w = RowVectorXd(ncoils*np);
134 const QString qPath = QString(QCoreApplication::applicationDirPath() +
"/../resources/general/coilDefinitions/coil_def.dat");
141 const Accuracy& accuracy)
143 if(channelList.isEmpty()) {
146 auto pCoilMeg =
FwdCoilSet::SPtr(m_pCoilDefinitions->create_meg_coils(channelList, channelList.size(),
static_cast<int>(accuracy),
nullptr));