MNE-CPP  beta 1.0
main.cpp
1 //=============================================================================================================
38 //*************************************************************************************************************
39 //=============================================================================================================
40 // INCLUDES
41 //=============================================================================================================
42 
43 #include <fs/label.h>
44 #include <fs/surface.h>
45 #include <fs/annotationset.h>
46 
47 #include <fiff/fiff_evoked.h>
48 #include <mne/mne_sourceestimate.h>
50 
51 #include <disp3D/inverseview.h>
52 
53 #include <iostream>
54 
55 
56 //*************************************************************************************************************
57 //=============================================================================================================
58 // QT INCLUDES
59 //=============================================================================================================
60 
61 #include <QGuiApplication>
62 #include <QSet>
63 
64 
65 //*************************************************************************************************************
66 //=============================================================================================================
67 // USED NAMESPACES
68 //=============================================================================================================
69 
70 using namespace MNELIB;
71 using namespace FSLIB;
72 using namespace FIFFLIB;
73 using namespace INVERSELIB;
74 using namespace DISP3DLIB;
75 
76 
77 //*************************************************************************************************************
78 //=============================================================================================================
79 // MAIN
80 //=============================================================================================================
81 
82 //=============================================================================================================
91 int main(int argc, char *argv[])
92 {
93  QGuiApplication a(argc, argv);
94 
95  //########################################################################################
96  // Source Estimate
97 
98  QFile t_fileFwd("./MNE-sample-data/MEG/sample/sample_audvis-meg-eeg-oct-6-fwd.fif");
99 
100  MNEForwardSolution t_Fwd(t_fileFwd);
101  if(t_Fwd.isEmpty())
102  return 1;
103 
104 
105  AnnotationSet t_annotSet("./MNE-sample-data/subjects/sample/label/lh.aparc.a2009s.annot","./MNE-sample-data/subjects/sample/label/rh.aparc.a2009s.annot");
106  SurfaceSet t_surfSet("./MNE-sample-data/subjects/sample/surf/lh.white", "./MNE-sample-data/subjects/sample/surf/rh.white");
107 
108  QList<Label> t_qListLabels;
109  QList<RowVector4i> t_qListRGBAs;
110 
111  //ToDo overload toLabels using instead of t_surfSet rr of MNESourceSpace
112  t_annotSet.toLabels(t_surfSet, t_qListLabels, t_qListRGBAs);
113 
114  InverseView view(t_Fwd.src, t_qListLabels, t_qListRGBAs, 24, true);
115 
116  if (view.stereoType() != QGLView::RedCyanAnaglyph)
117  view.camera()->setEyeSeparation(0.3f);
118  QStringList args = QCoreApplication::arguments();
119  int w_pos = args.indexOf("-width");
120  int h_pos = args.indexOf("-height");
121  if (w_pos >= 0 && h_pos >= 0)
122  {
123  bool ok = true;
124  int w = args.at(w_pos + 1).toInt(&ok);
125  if (!ok)
126  {
127  qWarning() << "Could not parse width argument:" << args;
128  return 1;
129  }
130  int h = args.at(h_pos + 1).toInt(&ok);
131  if (!ok)
132  {
133  qWarning() << "Could not parse height argument:" << args;
134  return 1;
135  }
136  view.resize(w, h);
137  }
138  else
139  {
140  view.resize(800, 600);
141  }
142  view.setTitle(QString("Online Brain Monitoring"));
143  view.show();
144 
145 // //Push Estimate
146 // view.pushSourceEstimate(sourceEstimate);
147 
148  return a.exec();
149 }
3D stereoscopic labels
Definition: inverseview.h:118
Minimum norm class declaration.
Annotation set.
Definition: annotationset.h:96
Definition: fiff.h:98
Surface class declaration.
MNESourceEstimate class declaration.
AnnotationSet class declaration.
InverseView class declaration.
Label class declaration.
A hemisphere set of surfaces.
Definition: surfaceset.h:83