本文整理汇总了C++中MNESourceEstimate::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ MNESourceEstimate::isEmpty方法的具体用法?C++ MNESourceEstimate::isEmpty怎么用?C++ MNESourceEstimate::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MNESourceEstimate
的用法示例。
在下文中一共展示了MNESourceEstimate::isEmpty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/**
* The function main marks the entry point of the program.
* By default, main has the storage class extern.
*
* @param [in] argc (argument count) is an integer that indicates how many arguments were entered on the command line when the program was started.
* @param [in] argv (argument vector) is an array of pointers to arrays of character objects. The array objects are null-terminated strings, representing the arguments that were entered on the command line when the program was started.
* @return the value that was set to exit() (which is 0 if exit() is called via quit()).
*/
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
// Command Line Parser
QCommandLineParser parser;
parser.setApplicationDescription("Clustered Inverse Example");
parser.addHelpOption();
QCommandLineOption sampleFwdFileOption("f", "Path to forward solution <file>.", "file", "./MNE-sample-data/MEG/sample/sample_audvis-meg-eeg-oct-6-fwd.fif");
QCommandLineOption sampleCovFileOption("c", "Path to covariance <file>.", "file", "./MNE-sample-data/MEG/sample/sample_audvis-cov.fif");
QCommandLineOption sampleEvokedFileOption("e", "Path to evoked <file>.", "file", "./MNE-sample-data/MEG/sample/sample_audvis-ave.fif");
parser.addOption(sampleFwdFileOption);
parser.addOption(sampleCovFileOption);
parser.addOption(sampleEvokedFileOption);
parser.process(app);
//########################################################################################
// Source Estimate
QFile t_fileFwd(parser.value(sampleFwdFileOption));
QFile t_fileCov(parser.value(sampleCovFileOption));
QFile t_fileEvoked(parser.value(sampleEvokedFileOption));
double snr = 1.0f;//3.0f;//0.1f;//3.0f;
QString method("dSPM"); //"MNE" | "dSPM" | "sLORETA"
QString t_sFileNameClusteredInv("");
QString t_sFileNameStc("");
// Parse command line parameters
for(qint32 i = 0; i < argc; ++i)
{
if(strcmp(argv[i], "-snr") == 0 || strcmp(argv[i], "--snr") == 0)
{
if(i + 1 < argc)
snr = atof(argv[i+1]);
}
else if(strcmp(argv[i], "-method") == 0 || strcmp(argv[i], "--method") == 0)
{
if(i + 1 < argc)
method = QString::fromUtf8(argv[i+1]);
}
else if(strcmp(argv[i], "-inv") == 0 || strcmp(argv[i], "--inv") == 0)
{
if(i + 1 < argc)
t_sFileNameClusteredInv = QString::fromUtf8(argv[i+1]);
}
else if(strcmp(argv[i], "-stc") == 0 || strcmp(argv[i], "--stc") == 0)
{
if(i + 1 < argc)
t_sFileNameStc = QString::fromUtf8(argv[i+1]);
}
}
double lambda2 = 1.0 / pow(snr, 2);
qDebug() << "Start calculation with: SNR" << snr << "; Lambda" << lambda2 << "; Method" << method << "; stc:" << t_sFileNameStc;
// Load data
fiff_int_t setno = 0;
QPair<QVariant, QVariant> baseline(QVariant(), 0);
FiffEvoked evoked(t_fileEvoked, setno, baseline);
if(evoked.isEmpty())
return 1;
std::cout << "evoked first " << evoked.first << "; last " << evoked.last << std::endl;
MNEForwardSolution t_Fwd(t_fileFwd);
if(t_Fwd.isEmpty())
return 1;
// AnnotationSet t_annotationSet("./MNE-sample-data/subjects/sample/label/lh.aparc.a2009s.annot", "./MNE-sample-data/subjects/sample/label/rh.aparc.a2009s.annot");
// AnnotationSet t_annotationSet("/home/chdinh/sl_data/subjects/mind006/label/lh.aparc.a2009s.annot", "/home/chdinh/sl_data/subjects/mind006/label/rh.aparc.a2009s.annot");
AnnotationSet t_annotationSet("E:/Data/sl_data/subjects/mind006/label/lh.aparc.a2009s.annot", "E:/Data/sl_data/subjects/mind006/label/rh.aparc.a2009s.annot");
FiffCov noise_cov(t_fileCov);
// regularize noise covariance
noise_cov = noise_cov.regularize(evoked.info, 0.05, 0.05, 0.1, true);
//
// Cluster forward solution;
//
MNEForwardSolution t_clusteredFwd = t_Fwd.cluster_forward_solution(t_annotationSet, 20);//40);
// std::cout << "Size " << t_clusteredFwd.sol->data.rows() << " x " << t_clusteredFwd.sol->data.cols() << std::endl;
// std::cout << "Clustered Fwd:\n" << t_clusteredFwd.sol->data.row(0) << std::endl;
//
// make an inverse operators
//
FiffInfo info = evoked.info;
//.........这里部分代码省略.........
示例2: main
/**
* The function main marks the entry point of the program.
* By default, main has the storage class extern.
*
* @param [in] argc (argument count) is an integer that indicates how many arguments were entered on the command line when the program was started.
* @param [in] argv (argument vector) is an array of pointers to arrays of character objects. The array objects are null-terminated strings, representing the arguments that were entered on the command line when the program was started.
* @return the value that was set to exit() (which is 0 if exit() is called via quit()).
*/
int main(int argc, char *argv[])
{
QGuiApplication a(argc, argv);
// QFile t_fileRaw("./MNE-sample-data/MEG/sample/sample_audvis_raw.fif");
// QFile t_fileFwd("./MNE-sample-data/MEG/sample/sample_audvis-eeg-oct-6-fwd.fif");
// AnnotationSet t_annotationSet("./MNE-sample-data/subjects/sample/label/lh.aparc.a2009s.annot", "./MNE-sample-data/subjects/sample/label/rh.aparc.a2009s.annot");
// SurfaceSet t_surfSet("./MNE-sample-data/subjects/sample/surf/lh.white", "./MNE-sample-data/subjects/sample/surf/rh.white");
// QFile t_fileRaw("E:/Data/sl_data/MEG/mind006/mind006_051209_auditory01_raw.fif");
// QFile t_fileFwd("E:/Data/sl_data/MEG/mind006/mind006_051209_auditory01_raw-oct-6p-fwd.fif");
// AnnotationSet t_annotationSet("E:/Data/sl_data/subjects/mind006/label/lh.aparc.a2009s.annot", "E:/Data/sl_data/subjects/mind006/label/rh.aparc.a2009s.annot");
// SurfaceSet t_surfSet("E:/Data/sl_data/subjects/mind006/surf/lh.white", "E:/Data/sl_data/subjects/mind006/surf/rh.white");
QFile t_fileRaw("E:/Data/sl_data/MEG/mind006/mind006_051209_median01_raw.fif");
QFile t_fileFwd("E:/Data/sl_data/MEG/mind006/mind006_051209_median01_raw-oct-6-fwd.fif");
AnnotationSet t_annotationSet("E:/Data/sl_data/subjects/mind006/label/lh.aparc.a2009s.annot", "E:/Data/sl_data/subjects/mind006/label/rh.aparc.a2009s.annot");
SurfaceSet t_surfSet("E:/Data/sl_data/subjects/mind006/surf/lh.white", "E:/Data/sl_data/subjects/mind006/surf/rh.white");
QString t_sFileNameStc("");//("mind006_051209_auditory01.stc");
qint32 numDipolePairs = 7;
qint32 samplesStcWindow = 100;
float stcOverlap = 0.0f;
qint32 startSample = 0;
qint32 numSample = 20000;
bool in_samples = true;
bool keep_comp = true;
// Parse command line parameters
for(qint32 i = 0; i < argc; ++i)
{
if(strcmp(argv[i], "-stc") == 0 || strcmp(argv[i], "--stc") == 0)
{
if(i + 1 < argc)
t_sFileNameStc = QString::fromUtf8(argv[i+1]);
}
}
//
// Read raw data
//
MNEForwardSolution t_Fwd(t_fileFwd);
if(t_Fwd.isEmpty())
return 1;
QList<Label> t_qListLabels;
QList<RowVector4i> t_qListRGBAs;
//ToDo overload toLabels using instead of t_surfSet rr of MNESourceSpace
t_annotationSet.toLabels(t_surfSet, t_qListLabels, t_qListRGBAs);
QList<Label> t_qListLabelSelection;
//LH
t_qListLabelSelection << t_qListLabels[28] << t_qListLabels[29] << t_qListLabels[45];
//RH
t_qListLabelSelection << t_qListLabels[103] << t_qListLabels[104] << t_qListLabels[120];
// std::cout << "t_qListLabelsTest.size " << t_qListLabelsTest.size() << std::endl;
// for(qint32 i = 0; i < t_qListLabelSelection.size(); ++i)
// {
// qDebug() << "Num" << i << t_qListLabelSelection[i].name;
// std::cout << t_qListLabelSelection[i].hemi << std::endl;
// }
MNEForwardSolution t_SelectFwd = t_Fwd.pick_regions(t_qListLabelSelection);
//
// Setup for reading the raw data
//
FiffRawData raw(t_fileRaw);
float from = raw.first_samp + startSample;
float to = from + numSample - 1;
//
// Set up pick list: MEG + STI 014 - bad channels
//
QStringList include;
// include << "STI 014";
bool want_meg = true;
bool want_eeg = false;
bool want_stim = false;
RowVectorXi picks = raw.info.pick_types(want_meg, want_eeg, want_stim, include);//, raw.info.bads);
//
//.........这里部分代码省略.........
示例3: main
/**
* The function main marks the entry point of the program.
* By default, main has the storage class extern.
*
* @param [in] argc (argument count) is an integer that indicates how many arguments were entered on the command line when the program was started.
* @param [in] argv (argument vector) is an array of pointers to arrays of character objects. The array objects are null-terminated strings, representing the arguments that were entered on the command line when the program was started.
* @return the value that was set to exit() (which is 0 if exit() is called via quit()).
*/
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//########################################################################################
//
// Source Estimate START
//
//########################################################################################
QFile t_fileFwd("./MNE-sample-data/MEG/sample/sample_audvis-meg-eeg-oct-6-fwd.fif");
QFile t_fileCov("./MNE-sample-data/MEG/sample/sample_audvis-cov.fif");
QFile t_fileEvoked("./MNE-sample-data/MEG/sample/sample_audvis-ave.fif");
QString t_sFileClusteredInverse("");//QFile t_fileClusteredInverse("./clusteredInverse-inv.fif");
AnnotationSet t_annotationSet ("sample", 2, "aparc.a2009s", "./MNE-sample-data/subjects");
double snr = 1.0;
double lambda2 = 1.0 / pow(snr, 2);
QString method("dSPM"); //"MNE" | "dSPM" | "sLORETA"
// Load data
fiff_int_t setno = 1;
QPair<QVariant, QVariant> baseline(QVariant(), 0);
FiffEvoked evoked(t_fileEvoked, setno, baseline);
if(evoked.isEmpty())
return 1;
std::cout << "Evoked description: " << evoked.comment.toLatin1().constData() << std::endl;
MNEForwardSolution t_Fwd(t_fileFwd);
if(t_Fwd.isEmpty())
return 1;
FiffCov noise_cov(t_fileCov);
// regularize noise covariance
noise_cov = noise_cov.regularize(evoked.info, 0.05, 0.05, 0.1, true);
//
// Cluster forward solution;
//
MNEForwardSolution t_clusteredFwd = t_Fwd;//.cluster_forward_solution(t_annotationSet, 40);
//
// make an inverse operators
//
FiffInfo info = evoked.info;
MNEInverseOperator inverse_operator(info, t_clusteredFwd, noise_cov, 0.2f, 0.8f);
if(!t_sFileClusteredInverse.isEmpty())
{
QFile t_fileClusteredInverse(t_sFileClusteredInverse);
inverse_operator.write(t_fileClusteredInverse);
}
//
// Compute inverse solution
//
MinimumNorm minimumNorm(inverse_operator, lambda2, method);
MNESourceEstimate sourceEstimate = minimumNorm.calculateInverse(evoked);
if(sourceEstimate.isEmpty())
return 1;
// // View activation time-series
// std::cout << "\nsourceEstimate:\n" << sourceEstimate.data.block(0,0,10,10) << std::endl;
// std::cout << "time\n" << sourceEstimate.times.block(0,0,1,10) << std::endl;
// std::cout << "timeMin\n" << sourceEstimate.times[0] << std::endl;
// std::cout << "timeMax\n" << sourceEstimate.times[sourceEstimate.times.size()-1] << std::endl;
// std::cout << "time step\n" << sourceEstimate.tstep << std::endl;
//########################################################################################
//
//Source Estimate END
//
//########################################################################################
//########################################################################################
//
// Create the test view START
//
//########################################################################################
std::cout<<"Creating BrainView"<<std::endl;
SurfaceSet tSurfSet ("sample", 2, "inflated", "./MNE-sample-data/subjects");
AnnotationSet tAnnotSet ("sample", 2, "aparc.a2009s", "./MNE-sample-data/subjects");
//Surface tSurfRight ("sample", 1, "inflated", "./MNE-sample-data/subjects");
//Annotation tAnnotRight ("sample", 1, "aparc.a2009s", "./MNE-sample-data/subjects");
//Surface tSurfLeft ("sample", 0, "inflated", "./MNE-sample-data/subjects");
//.........这里部分代码省略.........
示例4: main
//.........这里部分代码省略.........
QString t_sFileNameClusteredInv("");
// Parse command line parameters
for(qint32 i = 0; i < argc; ++i)
{
if(strcmp(argv[i], "-snr") == 0 || strcmp(argv[i], "--snr") == 0)
{
if(i + 1 < argc)
snr = atof(argv[i+1]);
}
else if(strcmp(argv[i], "-method") == 0 || strcmp(argv[i], "--method") == 0)
{
if(i + 1 < argc)
method = QString::fromUtf8(argv[i+1]);
}
else if(strcmp(argv[i], "-inv") == 0 || strcmp(argv[i], "--inv") == 0)
{
if(i + 1 < argc)
t_sFileNameClusteredInv = QString::fromUtf8(argv[i+1]);
}
else if(strcmp(argv[i], "-stc") == 0 || strcmp(argv[i], "--stc") == 0)
{
if(i + 1 < argc)
t_sFileNameStc = QString::fromUtf8(argv[i+1]);
}
}
double lambda2 = 1.0 / pow(snr, 2);
qDebug() << "Start calculation with: SNR" << snr << "; Lambda" << lambda2 << "; Method" << method << "; stc:" << t_sFileNameStc;
MNEForwardSolution t_Fwd(t_fileFwd);
if(t_Fwd.isEmpty())
return 1;
FiffCov noise_cov(t_fileCov);
// regularize noise covariance
noise_cov = noise_cov.regularize(evoked.info, 0.05, 0.05, 0.1, true);
//
// Cluster forward solution;
//
MNEForwardSolution t_clusteredFwd = t_Fwd.cluster_forward_solution(t_annotationSet, 20);//40); % Use multithreading
//MNEForwardSolution t_clusteredFwd = t_Fwd.cluster_forward_solution(t_annotationSet, 10);//40);
//MNEForwardSolution t_clusteredFwd = t_Fwd;
//
// Find rows of interest in stc files
//
QFile wrtFWD ("./mne_x_plugins/resources/tmsi/fwd_clustered.txt");
wrtFWD.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream out(&wrtFWD);
//Read vertnos
VectorXi vertno_left = t_clusteredFwd.src[0].vertno;
VectorXi vertno_right = t_clusteredFwd.src[1].vertno;
out<<"Vertno Left Hemi:"<<endl<<endl;
for(int i=0; i<vertno_left.rows(); i++)
out<<vertno_left[i]<<endl;
out<<endl<<"Vertno right Hemi:"<<endl<<endl;
示例5: main
/**
* The function main marks the entry point of the program.
* By default, main has the storage class extern.
*
* @param [in] argc (argument count) is an integer that indicates how many arguments were entered on the command line when the program was started.
* @param [in] argv (argument vector) is an array of pointers to arrays of character objects. The array objects are null-terminated strings, representing the arguments that were entered on the command line when the program was started.
* @return the value that was set to exit() (which is 0 if exit() is called via quit()).
*/
int main(int argc, char *argv[])
{
QGuiApplication a(argc, argv);
//########################################################################################
// Source Estimate
QFile t_fileFwd("./MNE-sample-data/MEG/sample/sample_audvis-meg-eeg-oct-6-fwd.fif");
QFile t_fileEvoked("./MNE-sample-data/MEG/sample/sample_audvis-ave.fif");
AnnotationSet t_annotationSet("sample", 2, "aparc.a2009s", "./MNE-sample-data/subjects");
SurfaceSet t_surfSet("sample", 2, "white", "./MNE-sample-data/subjects");
QString t_sFileNameStc("");//"RapMusic.stc");
qint32 numDipolePairs = 7;
bool doMovie = false;//true;
// Parse command line parameters
for(qint32 i = 0; i < argc; ++i)
{
if(strcmp(argv[i], "-stc") == 0 || strcmp(argv[i], "--stc") == 0)
{
if(i + 1 < argc)
t_sFileNameStc = QString::fromUtf8(argv[i+1]);
}else if(strcmp(argv[i], "-num") == 0 || strcmp(argv[i], "--num") == 0)
{
if(i + 1 < argc)
numDipolePairs = atof(argv[i+1]);
}
}
qDebug() << "Start calculation with stc:" << t_sFileNameStc;
// Load data
fiff_int_t setno = 0;
QPair<QVariant, QVariant> baseline(QVariant(), 0);
FiffEvoked evoked(t_fileEvoked, setno, baseline);
if(evoked.isEmpty())
return 1;
std::cout << "evoked first " << evoked.first << "; last " << evoked.last << std::endl;
MNEForwardSolution t_Fwd(t_fileFwd);
if(t_Fwd.isEmpty())
return 1;
QStringList ch_sel_names = t_Fwd.info.ch_names;
FiffEvoked pickedEvoked = evoked.pick_channels(ch_sel_names);
//
// Cluster forward solution;
//
MNEForwardSolution t_clusteredFwd = t_Fwd.cluster_forward_solution(t_annotationSet, 20);//40);
// std::cout << "Size " << t_clusteredFwd.sol->data.rows() << " x " << t_clusteredFwd.sol->data.cols() << std::endl;
// std::cout << "Clustered Fwd:\n" << t_clusteredFwd.sol->data.row(0) << std::endl;
RapMusic t_rapMusic(t_clusteredFwd, false, numDipolePairs);
if(doMovie)
t_rapMusic.setStcAttr(200,0.5);
MNESourceEstimate sourceEstimate = t_rapMusic.calculateInverse(pickedEvoked);
if(sourceEstimate.isEmpty())
return 1;
QList<Label> t_qListLabels;
QList<RowVector4i> t_qListRGBAs;
//ToDo overload toLabels using instead of t_surfSet rr of MNESourceSpace
t_annotationSet.toLabels(t_surfSet, t_qListLabels, t_qListRGBAs);
InverseView view(t_rapMusic.getSourceSpace(), t_qListLabels, t_qListRGBAs, 24, true, false, false);//true);
if (view.stereoType() != QGLView::RedCyanAnaglyph)
view.camera()->setEyeSeparation(0.3f);
QStringList args = QCoreApplication::arguments();
int w_pos = args.indexOf("-width");
int h_pos = args.indexOf("-height");
if (w_pos >= 0 && h_pos >= 0)
{
bool ok = true;
int w = args.at(w_pos + 1).toInt(&ok);
if (!ok)
{
qWarning() << "Could not parse width argument:" << args;
return 1;
//.........这里部分代码省略.........
示例6: main
//.........这里部分代码省略.........
// for(qint32 i = 0; i < vecSel.size(); ++i)
// {
// vecSel(i) = i;
// }
// //Option 3 - Manual selection
// VectorXi vecSel(20);
// vecSel << 76, 74, 13, 61, 97, 94, 75, 71, 60, 56, 26, 57, 56, 0, 52, 72, 33, 86, 96, 67;
std::cout << "Select following epochs to average:\n" << vecSel << std::endl;
FiffEvoked evoked = data.average(raw.info, tmin*raw.info.sfreq, floor(tmax*raw.info.sfreq + 0.5), vecSel);
//########################################################################################
// Source Estimate
//
// Settings
//
double snr = parser.value(snrOption).toDouble();
QString method(parser.value(methodOption));
QString t_sFileNameClusteredInv(parser.value(invFileOutOption));
QString t_sFileNameStc(parser.value(stcFileOutOption));
double lambda2 = 1.0 / pow(snr, 2);
qDebug() << "Start calculation with: SNR" << snr << "; Lambda" << lambda2 << "; Method" << method << "; stc:" << t_sFileNameStc;
//
// Load data
//
MNEForwardSolution t_Fwd(t_fileFwd);
if(t_Fwd.isEmpty())
return 1;
FiffCov noise_cov(t_fileCov);
//
// regularize noise covariance
//
noise_cov = noise_cov.regularize(evoked.info, 0.05, 0.05, 0.1, true);
//
// Cluster forward solution;
//
MatrixXd D;
MNEForwardSolution t_clusteredFwd = t_Fwd.cluster_forward_solution(t_annotationSet, 20, D, noise_cov, evoked.info);
//
// make an inverse operators
//
FiffInfo info = evoked.info;
MNEInverseOperator inverse_operator(info, t_clusteredFwd, noise_cov, 0.2f, 0.8f);
//
// save clustered inverse
//
if(!t_sFileNameClusteredInv.isEmpty())
{
QFile t_fileClusteredInverse(t_sFileNameClusteredInv);
inverse_operator.write(t_fileClusteredInverse);
}
//
示例7: main
/**
* The function main marks the entry point of the program.
* By default, main has the storage class extern.
*
* @param [in] argc (argument count) is an integer that indicates how many arguments were entered on the command line when the program was started.
* @param [in] argv (argument vector) is an array of pointers to arrays of character objects. The array objects are null-terminated strings, representing the arguments that were entered on the command line when the program was started.
* @return the value that was set to exit() (which is 0 if exit() is called via quit()).
*/
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// Command Line Parser
QCommandLineParser parser;
parser.setApplicationDescription("Clustered Inverse Powell Rap Music Raw Example");
parser.addHelpOption();
QCommandLineOption inputOption("fileIn", "The input file <in>.", "in", QCoreApplication::applicationDirPath() + "/MNE-sample-data/MEG/sample/sample_audvis_raw.fif");
QCommandLineOption eventsFileOption("eve", "Path to the event <file>.", "file", QCoreApplication::applicationDirPath() + "/MNE-sample-data/MEG/sample/sample_audvis_raw-eve.fif");
QCommandLineOption fwdOption("fwd", "Path to forwad solution <file>.", "file", QCoreApplication::applicationDirPath() + "/MNE-sample-data/MEG/sample/sample_audvis-meg-eeg-oct-6-fwd.fif");
QCommandLineOption surfOption("surfType", "Surface type <type>.", "type", "orig");
QCommandLineOption annotOption("annotType", "Annotation type <type>.", "type", "aparc.a2009s");
QCommandLineOption subjectOption("subject", "Selected subject <subject>.", "subject", "sample");
QCommandLineOption subjectPathOption("subjectPath", "Selected subject path <subjectPath>.", "subjectPath", QCoreApplication::applicationDirPath() + "/MNE-sample-data/subjects");
QCommandLineOption stcFileOption("stcOut", "Path to stc <file>, which is to be written.", "file", "");
QCommandLineOption numDipolePairsOption("numDip", "<number> of dipole pairs to localize.", "number", "7");
QCommandLineOption evokedIdxOption("aveIdx", "The average <index> to choose from the average file.", "index", "1");
QCommandLineOption hemiOption("hemi", "Selected hemisphere <hemi>.", "hemi", "2");
QCommandLineOption doMovieOption("doMovie", "Create overlapping movie.", "doMovie", "false");
QCommandLineOption keepCompOption("keepComp", "Keep compensators.", "keepComp", "false");
QCommandLineOption pickAllOption("pickAll", "Pick all channels.", "pickAll", "true");
QCommandLineOption destCompsOption("destComps", "<Destination> of the compensator which is to be calculated.", "destination", "0");
parser.addOption(inputOption);
parser.addOption(eventsFileOption);
parser.addOption(fwdOption);
parser.addOption(surfOption);
parser.addOption(annotOption);
parser.addOption(subjectOption);
parser.addOption(subjectPathOption);
parser.addOption(stcFileOption);
parser.addOption(numDipolePairsOption);
parser.addOption(evokedIdxOption);
parser.addOption(hemiOption);
parser.addOption(doMovieOption);
parser.addOption(keepCompOption);
parser.addOption(pickAllOption);
parser.addOption(destCompsOption);
parser.process(a);
//Load data
QFile t_fileRaw(parser.value(inputOption));
QString t_sEventName = parser.value(eventsFileOption);
QFile t_fileFwd(parser.value(fwdOption));
SurfaceSet t_surfSet (parser.value(subjectOption), parser.value(hemiOption).toInt(), parser.value(surfOption), parser.value(subjectPathOption));
AnnotationSet t_annotationSet (parser.value(subjectOption), parser.value(hemiOption).toInt(), parser.value(annotOption), parser.value(subjectPathOption));
QString t_sFileNameStc(parser.value(stcFileOption));
qint32 numDipolePairs = parser.value(numDipolePairsOption).toInt();
//Choose average
qint32 event = parser.value(evokedIdxOption).toInt();
float tmin = 0.1f;
float tmax = 0.2f;
bool keep_comp = false;
if(parser.value(keepCompOption) == "false" || parser.value(keepCompOption) == "0") {
keep_comp = false;
} else if(parser.value(keepCompOption) == "true" || parser.value(keepCompOption) == "1") {
keep_comp = true;
}
fiff_int_t dest_comp = parser.value(destCompsOption).toInt();
bool pick_all = false;
if(parser.value(pickAllOption) == "false" || parser.value(pickAllOption) == "0") {
pick_all = false;
} else if(parser.value(pickAllOption) == "true" || parser.value(pickAllOption) == "1") {
pick_all = true;
}
qint32 k, p;
bool doMovie = false;
if(parser.value(doMovieOption) == "false" || parser.value(doMovieOption) == "0") {
pick_all = false;
} else if(parser.value(doMovieOption) == "true" || parser.value(doMovieOption) == "1") {
pick_all = true;
}
//
// Load data
//
MNEForwardSolution t_Fwd(t_fileFwd);
if(t_Fwd.isEmpty())
return 1;
//.........这里部分代码省略.........
示例8: main
//.........这里部分代码省略.........
qDebug() << "Raw data" << sRawName;
QString t_sEventName = parser.value(srcDirectoryOption)+parser.value(eveFileOption);
qDebug() << "Events" << t_sEventName;
qint32 eveNum = (qint32)parser.value(evenNumOption).toInt();
qDebug() << "Event Number" << eveNum;
QString t_sSubjectsDir = parser.value(subjDirectoryOption);
qDebug() << "Subjects Directory" << t_sSubjectsDir;
QString t_sSubject = parser.value(subjIdOption);
qDebug() << "Subject" << t_sSubject;
//Targets
QString sTargetDir = parser.value(targetDirectoryOption);
qDebug() << "Target Directory" << sTargetDir;
QString sTargetPrefix = parser.value(targetPrefixOption);
qDebug() << "Target Prefix" << sTargetPrefix;
//Parameters
float tmin = (float)parser.value(tMinOption).toFloat();
qDebug() << "tMin" << tmin;
float tmax = (float)parser.value(tMaxOption).toFloat();
qDebug() << "tMax" << tmax;
QFile t_fileFwd(sFwdName);
//
// Load data
//
MNEForwardSolution t_Fwd(t_fileFwd);
if(t_Fwd.isEmpty())
return 1;
AnnotationSet t_annotationSet(t_sSubject, 2, "aparc.a2009s", t_sSubjectsDir);
// std::cout << "LabelIDs:\n" << t_annotationSet[0].getColortable().getLabelIds() << std::endl;
//
// Cluster forward solution;
//
MNEForwardSolution t_clusteredFwd = t_Fwd.cluster_forward_solution(t_annotationSet, 20);//40);
QFile t_fileRaw(sRawName);
// bool doMovie = false;//true;
qint32 numDipolePairs = 1;
bool keep_comp = false;
fiff_int_t dest_comp = 0;
bool pick_all = true;
qint32 k, p;
//
// Setup for reading the raw data
//
FiffRawData raw(t_fileRaw);
RowVectorXi picks;
if (pick_all)
示例9: main
//.........这里部分代码省略.........
if(strcmp(argv[i], "-snr") == 0 || strcmp(argv[i], "--snr") == 0)
{
if(i + 1 < argc)
snr = atof(argv[i+1]);
}
else if(strcmp(argv[i], "-method") == 0 || strcmp(argv[i], "--method") == 0)
{
if(i + 1 < argc)
method = QString::fromUtf8(argv[i+1]);
}
else if(strcmp(argv[i], "-inv") == 0 || strcmp(argv[i], "--inv") == 0)
{
if(i + 1 < argc)
t_sFileNameClusteredInv = QString::fromUtf8(argv[i+1]);
}
else if(strcmp(argv[i], "-stc") == 0 || strcmp(argv[i], "--stc") == 0)
{
if(i + 1 < argc)
t_sFileNameStc = QString::fromUtf8(argv[i+1]);
}
}
double lambda2 = 1.0 / pow(snr, 2);
qDebug() << "Start calculation with: SNR" << snr << "; Lambda" << lambda2 << "; Method" << method << "; stc:" << t_sFileNameStc;
// // Load data
// fiff_int_t setno = 1;
// QPair<QVariant, QVariant> baseline(QVariant(), 0);
// FiffEvoked evoked(t_fileEvoked, setno, baseline);
// if(evoked.isEmpty())
// return 1;
MNEForwardSolution t_Fwd(t_fileFwd);
if(t_Fwd.isEmpty())
return 1;
FiffCov noise_cov(t_fileCov);
// regularize noise covariance
noise_cov = noise_cov.regularize(evoked.info, 0.05, 0.05, 0.1, true);
//
// Cluster forward solution;
//
MNEForwardSolution t_clusteredFwd = t_Fwd.cluster_forward_solution_ccr(t_annotationSet, 20);//40);
//
// make an inverse operators
//
FiffInfo info = evoked.info;
MNEInverseOperator inverse_operator(info, t_clusteredFwd, noise_cov, 0.2f, 0.8f);
//
// save clustered inverse
//
if(!t_sFileNameClusteredInv.isEmpty())
{
QFile t_fileClusteredInverse(t_sFileNameClusteredInv);
inverse_operator.write(t_fileClusteredInverse);
}
//
// Compute inverse solution
//