38 #ifndef MNE_FORWARDSOLUTION_H
39 #define MNE_FORWARDSOLUTION_H
72 #include <QSharedPointer>
73 #include <QDataStream>
117 QString t_sDistMeasure;
119 t_sDistMeasure = QString(
"cityblock");
130 t_kMeans.
calculate(this->matRoiGWhitened, this->nClusters, p_RegionDataOut.
roiIdx, p_RegionDataOut.
ctrs, p_RegionDataOut.
sumd, p_RegionDataOut.
D);
132 Eigen::MatrixXd newCtrs = Eigen::MatrixXd::Zero(p_RegionDataOut.
ctrs.rows(), p_RegionDataOut.
ctrs.cols());
133 for(qint32 c = 0; c < p_RegionDataOut.
ctrs.rows(); ++c)
137 for(qint32 idx = 0; idx < p_RegionDataOut.
roiIdx.size(); ++idx)
139 if(c == p_RegionDataOut.
roiIdx[idx])
141 newCtrs.row(c) += this->matRoiG.row(idx);
147 newCtrs.row(c) /= num;
149 p_RegionDataOut.
ctrs = newCtrs;
152 t_kMeans.
calculate(this->matRoiG, this->nClusters, p_RegionDataOut.
roiIdx, p_RegionDataOut.
ctrs, p_RegionDataOut.
sumd, p_RegionDataOut.
D);
156 return p_RegionDataOut;
162 static Eigen::MatrixXd defaultD;
173 typedef QSharedPointer<MNEForwardSolution>
SPtr;
174 typedef QSharedPointer<const MNEForwardSolution>
ConstSPtr;
195 bool force_fixed =
false,
196 bool surf_ori =
false,
197 const QStringList& include = FIFFLIB::defaultQStringList,
198 const QStringList& exclude = FIFFLIB::defaultQStringList,
199 bool bExcludeBads =
false);
236 qint32 p_iClusterSize,
237 Eigen::MatrixXd& p_D = defaultD,
240 QString p_sMethod =
"cityblock")
const;
271 const Eigen::MatrixXd &patch_areas = FIFFLIB::defaultConstMatrixXd,
272 bool limit_depth_chs =
false);
280 inline bool isClustered()
const;
288 inline bool isEmpty()
const;
296 inline bool isFixedOrient()
const;
309 MNEForwardSolution pick_channels(
const QStringList& include = FIFFLIB::defaultQStringList,
310 const QStringList& exclude = FIFFLIB::defaultQStringList)
const;
337 const QStringList& include = FIFFLIB::defaultQStringList,
338 const QStringList& exclude = FIFFLIB::defaultQStringList)
const;
357 Eigen::MatrixXd &gain,
359 Eigen::MatrixXd &p_outWhitener,
360 qint32 &p_outNumNonZero)
const;
407 Eigen::VectorXi tripletSelection(
const Eigen::VectorXi& p_vecIdxSelection)
const
409 Eigen::MatrixXi triSelect = p_vecIdxSelection.transpose().replicate(3,1).array() * 3;
410 triSelect.row(1).array() += 1;
411 triSelect.row(2).array() += 2;
412 Eigen::VectorXi retTriSelect(triSelect.cols()*3);
413 for(
int i = 0; i < triSelect.cols(); ++i)
414 retTriSelect.block(i*3,0,3,1) = triSelect.col(i);
434 static bool read(QIODevice& p_IODevice,
436 bool force_fixed =
false,
437 bool surf_ori =
false,
438 const QStringList& include = FIFFLIB::defaultQStringList,
439 const QStringList& exclude = FIFFLIB::defaultQStringList,
440 bool bExcludeBads =
true);
453 MNEForwardSolution reduce_forward_solution(qint32 p_iNumDipoles, Eigen::MatrixXd& p_D)
const;
462 static void restrict_gain_matrix(Eigen::MatrixXd &G,
const FIFFLIB::FiffInfo &info);
499 Eigen::MatrixX3f getSourcePositionsByLabel(
const QList<FSLIB::Label> &lPickedLabels,
540 return src[0].isClustered();
547 return this->
nchan <= 0;
554 return this->
source_ori == FIFFV_MNE_FIXED_ORI;
561 out <<
"#### MNE Forward Solution ####\n";
563 out <<
"\n source_ori: " << p_MNEForwardSolution.
source_ori << std::endl;
564 out <<
"\n coord_frame: " << p_MNEForwardSolution.
coord_frame << std::endl;
565 out <<
"\n nsource: " << p_MNEForwardSolution.
nsource << std::endl;
566 out <<
"\n nchan: " << p_MNEForwardSolution.
nchan << std::endl;
567 out <<
"\n sol:\n\t" << *p_MNEForwardSolution.
sol.data() << std::endl;
568 out <<
"\n sol_grad:\n\t" << *p_MNEForwardSolution.
sol_grad.data() << std::endl;
592 #endif // MNE_FORWARDSOLUTION_H