MNE-CPP  0.1.9
A Framework for Electrophysiology
bemsurfacetreeitem.cpp
Go to the documentation of this file.
1 //=============================================================================================================
35 //=============================================================================================================
36 // INCLUDES
37 //=============================================================================================================
38 
39 #include "bemsurfacetreeitem.h"
40 #include "../common/metatreeitem.h"
41 #include "../../3dhelpers/renderable3Dentity.h"
42 #include "../../materials/pervertexphongalphamaterial.h"
43 #include "../../3dhelpers/custommesh.h"
44 
45 #include <mne/mne_bem.h>
46 
47 //=============================================================================================================
48 // QT INCLUDES
49 //=============================================================================================================
50 
51 //=============================================================================================================
52 // EIGEN INCLUDES
53 //=============================================================================================================
54 
55 //=============================================================================================================
56 // USED NAMESPACES
57 //=============================================================================================================
58 
59 using namespace DISP3DLIB;
60 using namespace Eigen;
61 using namespace MNELIB;
62 
63 //=============================================================================================================
64 // DEFINE MEMBER METHODS
65 //=============================================================================================================
66 
67 BemSurfaceTreeItem::BemSurfaceTreeItem(Qt3DCore::QEntity *p3DEntityParent, int iType, const QString& text)
68 : AbstractMeshTreeItem(p3DEntityParent, iType, text)
69 {
70  initItem();
71 }
72 
73 //=============================================================================================================
74 
76 {
77 // //Set material
78 // QPointer<PerVertexPhongAlphaMaterial> pBemMaterial = new PerVertexPhongAlphaMaterial(true);
79 // this->setMaterial(pBemMaterial);
80 }
81 
82 //=============================================================================================================
83 
85 {
86  //Create default color
87  MatrixX4f matVertColor = createVertColor(tBemSurface.rr.rows());
88 
89  //Set renderable 3D entity mesh and color data
90  m_pCustomMesh->setMeshData(tBemSurface.rr,
91  tBemSurface.nn,
92  tBemSurface.tris,
93  matVertColor,
94  Qt3DRender::QGeometryRenderer::Triangles);
95 
96  //Find out BEM layer type and change items name
97  this->setText(MNEBemSurface::id_name(tBemSurface.id));
98 
99  //Add data which is held by this BemSurfaceTreeItem
100  QVariant data;
101 
102  data.setValue(tBemSurface.rr.rows());
103  this->setData(data, Data3DTreeModelItemRoles::NumberVertices);
104 }
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
MNELIB::MNEBemSurface::rr
Eigen::MatrixX3f rr
Definition: mne_bem_surface.h:163
MNELIB::MNEBemSurface::id
FIFFLIB::fiff_int_t id
Definition: mne_bem_surface.h:158
MNELIB::MNEBemSurface::nn
Eigen::MatrixX3f nn
Definition: mne_bem_surface.h:164
DISP3DLIB::BemSurfaceTreeItem::addData
void addData(const MNELIB::MNEBemSurface &tBemSurface)
Definition: bemsurfacetreeitem.cpp:84
DISP3DLIB::AbstractMeshTreeItem
Provides a generic mesh tree item.
Definition: abstractmeshtreeitem.h:90
mne_bem.h
MNEBem class declaration.
DISP3DLIB::BemSurfaceTreeItem::BemSurfaceTreeItem
BemSurfaceTreeItem(Qt3DCore::QEntity *p3DEntityParent=0, int iType=Data3DTreeModelItemTypes::BemSurfaceItem, const QString &text="BEM Surface Item")
Definition: bemsurfacetreeitem.cpp:67
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
DISP3DLIB::BemSurfaceTreeItem::initItem
virtual void initItem() override
Definition: bemsurfacetreeitem.cpp:75
bemsurfacetreeitem.h
BemSurfaceTreeItem class declaration.