MNE-CPP  0.1.9
A Framework for Electrophysiology
sensorsurfacetreeitem.cpp
Go to the documentation of this file.
1 //=============================================================================================================
36 //=============================================================================================================
37 // INCLUDES
38 //=============================================================================================================
39 
40 #include "sensorsurfacetreeitem.h"
41 #include "../common/metatreeitem.h"
42 #include "../../3dhelpers/renderable3Dentity.h"
43 #include "../../materials/pervertexphongalphamaterial.h"
44 #include "../../3dhelpers/custommesh.h"
45 
46 #include <mne/mne_bem.h>
47 
48 //=============================================================================================================
49 // QT INCLUDES
50 //=============================================================================================================
51 
52 //=============================================================================================================
53 // EIGEN INCLUDES
54 //=============================================================================================================
55 
56 //=============================================================================================================
57 // USED NAMESPACES
58 //=============================================================================================================
59 
60 using namespace DISP3DLIB;
61 using namespace Eigen;
62 using namespace MNELIB;
63 
64 //=============================================================================================================
65 // DEFINE MEMBER METHODS
66 //=============================================================================================================
67 
68 SensorSurfaceTreeItem::SensorSurfaceTreeItem(Qt3DCore::QEntity *p3DEntityParent, int iType, const QString& text)
69 : AbstractMeshTreeItem(p3DEntityParent, iType, text)
70 {
71  initItem();
72 }
73 
74 //=============================================================================================================
75 
77 {
78  this->setEditable(false);
79  this->setCheckable(true);
80  this->setCheckState(Qt::Checked);
81  this->setToolTip("Sensor surface item");
82 
83  //Set material to enable sorting
85  this->setMaterial(pBemMaterial);
86 }
87 
88 //=============================================================================================================
89 
90 void SensorSurfaceTreeItem::addData(const MNEBemSurface& tSensorSurface)
91 {
92  //Create color from curvature information with default gyri and sulcus colors
93  MatrixX4f matVertColor = createVertColor(tSensorSurface.rr.rows());
94 
95  //Set renderable 3D entity mesh and color data
96  m_pCustomMesh->setMeshData(tSensorSurface.rr,
97  tSensorSurface.nn,
98  tSensorSurface.tris,
99  matVertColor,
100  Qt3DRender::QGeometryRenderer::Triangles);
101 
102  //Add data which is held by this SensorSurfaceTreeItem
103  QVariant data;
104 
105  data.setValue(tSensorSurface.rr.rows());
106  this->setData(data, Data3DTreeModelItemRoles::NumberVertices);
107 }
108 
DISP3DLIB::AbstractMeshTreeItem::setData
virtual void setData(const QVariant &value, int role=Qt::UserRole+1)
Definition: abstractmeshtreeitem.cpp:169
MNELIB::MNEBemSurface::tris
Eigen::MatrixX3i tris
Definition: mne_bem_surface.h:165
DISP3DLIB::AbstractMeshTreeItem::m_pCustomMesh
QPointer< CustomMesh > m_pCustomMesh
Definition: abstractmeshtreeitem.h:200
DISP3DLIB::PerVertexPhongAlphaMaterial
PerVertexPhongAlphaMaterial is provides a Qt3D material with own shader support.
Definition: pervertexphongalphamaterial.h:80
DISP3DLIB::SensorSurfaceTreeItem::initItem
void initItem()
Definition: sensorsurfacetreeitem.cpp:76
MNELIB::MNEBemSurface::rr
Eigen::MatrixX3f rr
Definition: mne_bem_surface.h:163
DISP3DLIB::SensorSurfaceTreeItem::addData
void addData(const MNELIB::MNEBemSurface &tSensorSurface)
Definition: sensorsurfacetreeitem.cpp:90
MNELIB::MNEBemSurface::nn
Eigen::MatrixX3f nn
Definition: mne_bem_surface.h:164
DISP3DLIB::SensorSurfaceTreeItem::SensorSurfaceTreeItem
SensorSurfaceTreeItem(Qt3DCore::QEntity *p3DEntityParent=0, int iType=Data3DTreeModelItemTypes::SensorSurfaceItem, const QString &text="Sensor Surface")
Definition: sensorsurfacetreeitem.cpp:68
DISP3DLIB::AbstractMeshTreeItem
Provides a generic mesh tree item.
Definition: abstractmeshtreeitem.h:90
mne_bem.h
MNEBem class declaration.
sensorsurfacetreeitem.h
SensorSurfaceTreeItem class declaration.
MNELIB::MNEBemSurface
BEM surface provides geometry information.
Definition: mne_bem_surface.h:79
DISP3DLIB::Abstract3DTreeItem::createVertColor
static Eigen::MatrixX4f createVertColor(int numVert, const QColor &color=QColor(0, 49, 69))
Definition: abstract3Dtreeitem.cpp:246