44 #include <fiff/fiff_evoked.h>
60 using namespace Eigen;
70 MinimumNorm::MinimumNorm(
const MNEInverseOperator &p_inverseOperator,
float lambda,
const QString method)
71 : m_inverseOperator(p_inverseOperator)
81 : m_inverseOperator(p_inverseOperator)
96 qint32 nave = p_fiffEvoked.
nave;
100 qWarning(
"Channel name check failed.");
104 doInverseSetup(nave,pick_normal);
111 printf(
"Picked %d channels from the data\n",t_fiffEvoked.
info.
nchan);
114 float tmin = ((float)t_fiffEvoked.
first) / t_fiffEvoked.
info.
sfreq;
192 qWarning(
"Inverse not setup -> call doInverseSetup first!");
196 MatrixXd sol = K * data;
200 printf(
"combining the current components...");
201 MatrixXd sol1(sol.rows()/3,sol.cols());
202 for(qint32 i = 0; i < sol.cols(); ++i)
205 sol1.block(0,i,sol.rows()/3,1) = tmp->cwiseSqrt();
208 sol.resize(sol1.rows(),sol1.cols());
219 printf(
"(sLORETA)...");
225 VectorXi p_vecVertices(inv.
src[0].vertno.
size() + inv.
src[1].vertno.
size());
226 p_vecVertices << inv.
src[0].vertno, inv.
src[1].vertno;
239 void MinimumNorm::doInverseSetup(qint32 nave,
bool pick_normal)
246 printf(
"Computing inverse...");
247 inv.
assemble_kernel(label, m_sMethod, pick_normal, K, noise_norm, vertno);
249 std::cout <<
"K " << K.rows() <<
" x " << K.cols() << std::endl;
259 return "Minimum Norm Estimate";
267 return m_inverseOperator.
src;
274 if(method.compare(
"MNE") == 0)
276 else if(method.compare(
"dSPM") == 0)
278 else if(method.compare(
"sLORETA") == 0)
282 qWarning(
"Method not recognized!");
287 printf(
"\tSet minimum norm method to %s.\n", method.toLatin1().constData());
297 qWarning(
"Cant activate dSPM and sLORETA at the same time! - Activating dSPM");
304 m_bsLORETA = sLORETA;
306 m_sMethod = QString(
"dSPM");
308 m_sMethod = QString(
"sLORETA");
310 m_sMethod = QString(
"MNE");
virtual const char * getName() const
Source Space descritpion.
bool assemble_kernel(const Label &label, QString method, bool pick_normal, MatrixXd &K, SparseMatrix< double > &noise_norm, QList< VectorXi > &vertno)
void setMethod(QString method)
static VectorXd * combine_xyz(const VectorXd &vec)
SparseMatrix< double > noisenorm
Minimum norm class declaration.
MNEInverseOperator prepare_inverse_operator(qint32 nave, float lambda2, bool dSPM, bool sLORETA=false) const
bool check_ch_names(const FiffInfo &info) const
FiffEvoked pick_channels(const QStringList &include=defaultQStringList, const QStringList &exclude=defaultQStringList) const
MNESourceEstimate class declaration.
void setRegularization(float lambda)
virtual const MNESourceSpace & getSourceSpace() const
MinimumNorm(const MNEInverseOperator &p_inverseOperator, float lambda, const QString method)
virtual MNESourceEstimate calculateInverse(const FiffEvoked &p_fiffEvoked, bool pick_normal=false)