MNE-CPP  0.1.9
A Framework for Electrophysiology
hemispheretreeitem.cpp
Go to the documentation of this file.
1 //=============================================================================================================
36 //=============================================================================================================
37 // INCLUDES
38 //=============================================================================================================
39 
40 #include "hemispheretreeitem.h"
41 #include "../freesurfer/fssurfacetreeitem.h"
42 #include "../freesurfer/fsannotationtreeitem.h"
43 #include "../sourcespace/sourcespacetreeitem.h"
44 #include "../sourcedata/mnedatatreeitem.h"
45 
46 #include <fs/label.h>
47 #include <fs/annotationset.h>
48 #include <fs/surfaceset.h>
49 
51 #include <mne/mne_sourceestimate.h>
52 
53 //=============================================================================================================
54 // QT INCLUDES
55 //=============================================================================================================
56 
57 //=============================================================================================================
58 // EIGEN INCLUDES
59 //=============================================================================================================
60 
61 #include <Eigen/Core>
62 
63 //=============================================================================================================
64 // USED NAMESPACES
65 //=============================================================================================================
66 
67 using namespace Eigen;
68 using namespace FSLIB;
69 using namespace MNELIB;
70 using namespace DISP3DLIB;
71 
72 //=============================================================================================================
73 // DEFINE MEMBER METHODS
74 //=============================================================================================================
75 
76 HemisphereTreeItem::HemisphereTreeItem(int iType,
77  const QString& text)
78 : AbstractTreeItem(iType, text)
79 {
80  initItem();
81 }
82 
83 //=============================================================================================================
84 
86 {
87  this->setEditable(false);
88  this->setCheckable(true);
89  this->setCheckState(Qt::Checked);
90  this->setToolTip("Brain hemisphere item");
91 }
92 
93 //=============================================================================================================
94 
96  const Annotation& tAnnotation,
97  Qt3DCore::QEntity* p3DEntityParent)
98 {
99  //Set name of HemisphereTreeItem based on the hemisphere information
100  switch (tSurface.hemi()) {
101  case 0:
102  this->setText("Left hemisphere");
103  break;
104  case 1:
105  this->setText("Right hemisphere");
106  break;
107  default:
108  this->setText("Unknown hemisphere");
109  break;
110  }
111 
112  QVariant data;
113  data.setValue(tSurface.hemi());
114 
115  this->setData(data, Data3DTreeModelItemRoles::SurfaceHemi);
116 
117  //Add childs
118  //Add surface child
119  FsSurfaceTreeItem* pSurfaceItem = new FsSurfaceTreeItem(p3DEntityParent,
120  Data3DTreeModelItemTypes::SurfaceItem, "Surface");
121 
122  QList<QStandardItem*> list;
123  list << pSurfaceItem;
124  list << new QStandardItem(pSurfaceItem->toolTip());
125  this->appendRow(list);
126 
127  pSurfaceItem->addData(tSurface);
128 
129  //Add annotation child
130  if(!tAnnotation.isEmpty()) {
131  FsAnnotationTreeItem* pAnnotItem = new FsAnnotationTreeItem(Data3DTreeModelItemTypes::AnnotationItem);
132 
135 
136  list.clear();
137  list << pAnnotItem;
138  list << new QStandardItem(pAnnotItem->toolTip());
139  this->appendRow(list);
140 
141  pAnnotItem->addData(tSurface, tAnnotation);
142  }
143 
144  return pSurfaceItem;
145 }
146 
147 //=============================================================================================================
148 
150  Qt3DCore::QEntity* p3DEntityParent)
151 {
152  //Set name of HemisphereTreeItem based on the hemisphere information
153  QVariant data;
154 
155  switch (tHemisphere.id) {
156  case 101:
157  this->setText("Left hemisphere");
158  data.setValue(0);
159  break;
160  case 102:
161  this->setText("Right hemisphere");
162  data.setValue(1);
163  break;
164  default:
165  this->setText("Unknown hemisphere");
166  data.setValue(-1);
167  break;
168  }
169 
170  this->setData(data, Data3DTreeModelItemRoles::SurfaceHemi);
171 
172  //Add extra info
173  SourceSpaceTreeItem* pSourceSpaceItem = new SourceSpaceTreeItem(p3DEntityParent, Data3DTreeModelItemTypes::SourceSpaceItem);
174 
175  QList<QStandardItem*> list;
176  list << pSourceSpaceItem;
177  list << new QStandardItem(pSourceSpaceItem->toolTip());
178  this->appendRow(list);
179 
180  pSourceSpaceItem->addData(tHemisphere);
181 
182  return pSourceSpaceItem;
183 }
DISP3DLIB::SourceSpaceTreeItem
Provides a generic brain tree item.
Definition: sourcespacetreeitem.h:86
DISP3DLIB::HemisphereTreeItem::addData
FsSurfaceTreeItem * addData(const FSLIB::Surface &tSurface, const FSLIB::Annotation &tAnnotation, Qt3DCore::QEntity *p3DEntityParent=0)
Definition: hemispheretreeitem.cpp:95
DISP3DLIB::FsSurfaceTreeItem::onAnnotationVisibilityChanged
void onAnnotationVisibilityChanged(bool isVisible)
Definition: fssurfacetreeitem.cpp:176
annotationset.h
AnnotationSet class declaration.
FSLIB::Surface::hemi
qint32 hemi() const
Definition: surface.h:301
DISP3DLIB::AbstractTreeItem
Provides the basic tree item.
Definition: abstracttreeitem.h:76
DISP3DLIB::FsSurfaceTreeItem
Provides a generic brain tree item.
Definition: fssurfacetreeitem.h:83
DISP3DLIB::AbstractTreeItem::setData
void setData(const QVariant &value, int role=Qt::UserRole+1)
Definition: abstracttreeitem.cpp:78
DISP3DLIB::FsAnnotationTreeItem::annotationVisibiltyChanged
void annotationVisibiltyChanged(bool isVisible)
surfaceset.h
SurfaceSet class declaration.
label.h
Label class declaration.
MNELIB::MNEHemisphere
Hemisphere provides geometry information.
Definition: mne_hemisphere.h:80
DISP3DLIB::HemisphereTreeItem::initItem
void initItem()
Definition: hemispheretreeitem.cpp:85
mne_forwardsolution.h
MNEForwardSolution class declaration, which provides the forward solution including the source space ...
FSLIB::Annotation::isEmpty
bool isEmpty() const
Definition: annotation.h:294
hemispheretreeitem.h
HemisphereTreeItem class declaration.
FSLIB::Annotation
Free surfer annotation.
Definition: annotation.h:80
FSLIB::Surface
FreeSurfer surface mesh.
Definition: surface.h:75
MNELIB::MNEHemisphere::id
FIFFLIB::fiff_int_t id
Definition: mne_hemisphere.h:181
mne_sourceestimate.h
MNESourceEstimate class declaration.
DISP3DLIB::FsAnnotationTreeItem
Provides a generic brain tree item.
Definition: fsannotationtreeitem.h:83