MNE-CPP  0.1.9
A Framework for Electrophysiology
ecdview.cpp
Go to the documentation of this file.
1 //=============================================================================================================
35 //=============================================================================================================
36 // INCLUDES
37 //=============================================================================================================
38 
39 #include "ecdview.h"
40 
41 #include "../engine/model/data3Dtreemodel.h"
42 
45 #include <mne/mne_bem.h>
46 
47 //=============================================================================================================
48 // QT INCLUDES
49 //=============================================================================================================
50 
51 //=============================================================================================================
52 // USED NAMESPACES
53 //=============================================================================================================
54 
55 using namespace DISP3DLIB;
56 using namespace INVERSELIB;
57 using namespace MNELIB;
58 using namespace Eigen;
59 using namespace FIFFLIB;
60 
61 //=============================================================================================================
62 // DEFINE MEMBER METHODS
63 //=============================================================================================================
64 
65 ECDView::ECDView(const DipoleFitSettings& dipFitSettings,
66  const ECDSet& ecdSet,
67  QWidget* parent,
68  Qt::WindowFlags f)
69 : AbstractView(parent, f)
70 {
71  //Read mri transform
72  QFile file(dipFitSettings.mriname);
73  ECDSet ecdSetTrans = ecdSet;
74 
75  if(file.exists()) {
76  FiffCoordTrans coordTrans(file);
77 
78  for(int i = 0; i < ecdSet.size() ; ++i) {
79  MatrixX3f dipoles(1, 3);
80  //transform location
81  dipoles(0,0) = ecdSet[i].rd(0);
82  dipoles(0,1) = ecdSet[i].rd(1);
83  dipoles(0,2) = ecdSet[i].rd(2);
84 
85  dipoles = coordTrans.apply_trans(dipoles);
86 
87  ecdSetTrans[i].rd(0) = dipoles(0,0);
88  ecdSetTrans[i].rd(1) = dipoles(0,1);
89  ecdSetTrans[i].rd(2) = dipoles(0,2);
90 
91  //transform orientation
92  dipoles(0,0) = ecdSet[i].Q(0);
93  dipoles(0,1) = ecdSet[i].Q(1);
94  dipoles(0,2) = ecdSet[i].Q(2);
95 
96  dipoles = coordTrans.apply_trans(dipoles, false);
97 
98  ecdSetTrans[i].Q(0) = dipoles(0,0);
99  ecdSetTrans[i].Q(1) = dipoles(0,1);
100  ecdSetTrans[i].Q(2) = dipoles(0,2);
101  }
102  } else {
103  qCritical("ECDView::ECDView - Cannot open FiffCoordTrans file");
104  }
105 
106  //Add ECD data
107  m_pData3DModel->addDipoleFitData("sample", QString("Set %1").arg(dipFitSettings.setno), ecdSetTrans);
108 
109  //Read and show BEM
110  QFile t_fileBem(dipFitSettings.bemname);
111 
112  if(t_fileBem.exists()) {
113  MNEBem t_Bem(t_fileBem);
114  m_pData3DModel->addBemData("sample", "BEM", t_Bem);
115  } else {
116  qCritical("ECDView::ECDView - Cannot open MNEBem file");
117  }
118 }
119 
120 //=============================================================================================================
121 
123 {
124 }
DISP3DLIB::AbstractView::m_pData3DModel
QSharedPointer< DISP3DLIB::Data3DTreeModel > m_pData3DModel
Definition: abstractview.h:150
DISP3DLIB::AbstractView
Adapter which provides the abstract class for all adapter views.
Definition: abstractview.h:81
MNELIB::MNEBem
BEM descritpion.
Definition: mne_bem.h:89
ecd_set.h
FiffDigPointSet class declaration.
INVERSELIB::DipoleFitSettings::bemname
QString bemname
Definition: dipole_fit_settings.h:115
INVERSELIB::ECDSet
Holds a set of Electric Current Dipoles.
Definition: ecd_set.h:80
INVERSELIB::ECDSet::size
qint32 size() const
Definition: ecd_set.h:193
INVERSELIB::DipoleFitSettings::setno
int setno
Definition: dipole_fit_settings.h:145
DISP3DLIB::ECDView::ECDView
ECDView(const INVERSELIB::DipoleFitSettings &dipFitSettings, const INVERSELIB::ECDSet &ecdSet, QWidget *parent=0, Qt::WindowFlags f=Qt::Widget)
Definition: ecdview.cpp:65
dipole_fit_settings.h
Dipole Fit Setting class declaration.
FIFFLIB::FiffCoordTrans::apply_trans
Eigen::MatrixX3f apply_trans(const Eigen::MatrixX3f &rr, bool do_move=true) const
Definition: fiff_coord_trans.cpp:184
mne_bem.h
MNEBem class declaration.
FIFFLIB::FiffCoordTrans
Coordinate transformation description.
Definition: fiff_coord_trans.h:74
ecdview.h
ECDView class declaration.
INVERSELIB::DipoleFitSettings
Dipole Fit setting implementation.
Definition: dipole_fit_settings.h:81
DISP3DLIB::ECDView::~ECDView
~ECDView()
Definition: ecdview.cpp:122
INVERSELIB::DipoleFitSettings::mriname
QString mriname
Definition: dipole_fit_settings.h:118