MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
mritreeitem.cpp
Go to the documentation of this file.
1//=============================================================================================================
35//=============================================================================================================
36// INCLUDES
37//=============================================================================================================
38
39#include "mritreeitem.h"
40#include "../freesurfer/fsannotationtreeitem.h"
41#include "../freesurfer/fssurfacetreeitem.h"
42#include "../hemisphere/hemispheretreeitem.h"
43
44#include <fs/annotationset.h>
45#include <fs/surfaceset.h>
46
47//=============================================================================================================
48// QT INCLUDES
49//=============================================================================================================
50
51//=============================================================================================================
52// EIGEN INCLUDES
53//=============================================================================================================
54
55//=============================================================================================================
56// USED NAMESPACES
57//=============================================================================================================
58
59using namespace FSLIB;
60using namespace DISP3DLIB;
61
62//=============================================================================================================
63// DEFINE MEMBER METHODS
64//=============================================================================================================
65
67 const QString& text)
68: AbstractTreeItem(iType, text)
69{
70 initItem();
71}
72
73//=============================================================================================================
74
76{
77 this->setEditable(false);
78 this->setCheckable(true);
79 this->setCheckState(Qt::Checked);
80 this->setToolTip("MRI item");
81}
82
83//=============================================================================================================
84
85QList<FsSurfaceTreeItem*> MriTreeItem::addData(const SurfaceSet& tSurfaceSet,
86 const AnnotationSet& tAnnotationSet,
87 Qt3DCore::QEntity* p3DEntityParent)
88{
89 //Generate child items based on surface set input parameters
90 QList<FsSurfaceTreeItem*> returnItemList;
91
92 //Search for already created hemi items and add source space data respectivley
93 for(int i = 0; i < tSurfaceSet.size(); ++i) {
94 if(i < tAnnotationSet.size()) {
95 returnItemList.append(addData(tSurfaceSet[i], tAnnotationSet[i], p3DEntityParent));
96 } else {
97 returnItemList.append(addData(tSurfaceSet[i], Annotation(), p3DEntityParent));
98 }
99 }
100
101 return returnItemList;
102}
103
104//=============================================================================================================
105
107 const Annotation& tAnnotation,
108 Qt3DCore::QEntity* p3DEntityParent)
109{
110 //Generate child items based on surface set input parameters
111 FsSurfaceTreeItem* pReturnItem = Q_NULLPTR;
112
113 QList<QStandardItem*> itemList = this->findChildren(Data3DTreeModelItemTypes::HemisphereItem);
114
115 bool hemiItemFound = false;
116
117 //Search for already created hemi items and add data respectivley
118 for(int j = 0; j < itemList.size(); ++j) {
119 if(HemisphereTreeItem* pHemiItem = dynamic_cast<HemisphereTreeItem*>(itemList.at(j))) {
120 if(pHemiItem->data(Data3DTreeModelItemRoles::SurfaceHemi).toInt() == tSurface.hemi()) {
121 hemiItemFound = true;
122
123 if(tAnnotation.hemi() == tSurface.hemi()) {
124 pReturnItem = pHemiItem->addData(tSurface, tAnnotation, p3DEntityParent);
125 } else {
126 pReturnItem = pHemiItem->addData(tSurface, Annotation(), p3DEntityParent);
127 }
128 }
129 }
130 }
131
132 //If item does not exist yet, create it here.
133 if(!hemiItemFound) {
134 HemisphereTreeItem* pHemiItem = new HemisphereTreeItem(Data3DTreeModelItemTypes::HemisphereItem);
135
136 if(tAnnotation.hemi() == tSurface.hemi()) {
137 pReturnItem = pHemiItem->addData(tSurface, tAnnotation, p3DEntityParent);
138 } else {
139 pReturnItem = pHemiItem->addData(tSurface, Annotation(), p3DEntityParent);
140 }
141
142 QList<QStandardItem*> list;
143 list << pHemiItem;
144 list << new QStandardItem(pHemiItem->toolTip());
145 this->appendRow(list);
146 }
147
148 return pReturnItem;
149}
150
AnnotationSet class declaration.
SurfaceSet class declaration.
MriTreeItem class declaration.
Provides the basic tree item.
QList< QStandardItem * > findChildren(int type)
Provides a generic brain tree item.
void addData(const FSLIB::Surface &tSurface)
Provides a generic brain tree item.
FsSurfaceTreeItem * addData(const FSLIB::Surface &tSurface, const FSLIB::Annotation &tAnnotation, Qt3DCore::QEntity *p3DEntityParent=0)
MriTreeItem(int iType=Data3DTreeModelItemTypes::MriItem, const QString &text="MRI")
QList< FsSurfaceTreeItem * > addData(const FSLIB::SurfaceSet &tSurfaceSet, const FSLIB::AnnotationSet &tAnnotationSet, Qt3DCore::QEntity *p3DEntityParent=0)
Free surfer annotation.
Definition annotation.h:81
qint32 hemi() const
Definition annotation.h:287
Annotation set.
qint32 size() const
FreeSurfer surface mesh.
Definition surface.h:76
qint32 hemi() const
Definition surface.h:301
A hemisphere set of surfaces.
Definition surfaceset.h:72
qint32 size() const
Definition surfaceset.h:264