MNE-CPP  beta 1.0
brainhemisphere.cpp
1 //=============================================================================================================
36 //*************************************************************************************************************
37 //=============================================================================================================
38 // INCLUDES
39 //=============================================================================================================
40 
41 #include "brainhemisphere.h"
42 
43 
44 //*************************************************************************************************************
45 //=============================================================================================================
46 // QT INCLUDES
47 //=============================================================================================================
48 
49 
50 //*************************************************************************************************************
51 //=============================================================================================================
52 // USED NAMESPACES
53 //=============================================================================================================
54 
55 using namespace DISP3DNEWLIB;
56 
57 
58 //*************************************************************************************************************
59 //=============================================================================================================
60 // DEFINE MEMBER METHODS
61 //=============================================================================================================
62 
64 : RenderableEntity(parent)
65 {
66  init();
67 }
68 
69 
70 //*************************************************************************************************************
71 
72 BrainHemisphere::BrainHemisphere(const Surface &surf, const QMap<int, QColor> &qmVertexColors, QNode *parent)
73 : RenderableEntity(parent)
74 , m_surface(surf)
75 , m_qmVertexColors(qmVertexColors)
76 {
77  init();
78 }
79 
80 
81 //*************************************************************************************************************
82 
83 void BrainHemisphere::updateActivation(const QMap<int, QColor> &qmVertexColor)
84 {
85  //std::cout<<"START BrainHemisphere::updateActivation()"<<std::endl;
86 
87  m_pSurfaceMesh->updateActivation(qmVertexColor);
88 // this->removeComponent(m_pSurfaceMesh);
89 
90 // if(m_pSurfaceMesh)
91 // delete m_pSurfaceMesh;
92 
93 // //Create mesh for left hemisphere
94 // m_pSurfaceMesh = new BrainSurfaceMesh(m_surface, qmVertexColor);
95 // m_pSurfaceMesh->setObjectName("m_pSurfaceMesh");
96 
97 // //this->setMesh(m_pSurfaceMesh.data());
98 // this->addComponent(m_pSurfaceMesh);
99 
100 // //m_pSurfaceMesh->update();
101  //std::cout<<"END BrainHemisphere::updateActivation()"<<std::endl;
102 }
103 
104 //*************************************************************************************************************
105 
106 void BrainHemisphere::init()
107 {
108  //Create mesh for left hemisphere
109  m_pSurfaceMesh = new BrainSurfaceMesh(m_surface, m_qmVertexColors);
110  m_pSurfaceMesh->setObjectName("m_pSurfaceMesh");
111 
112  //this->setMesh(m_pSurfaceMesh.data());
113  this->addComponent(m_pSurfaceMesh);
114 
115  //Translate to the right if this hemisphere is right hemisphere and is inflated
116  if(m_surface.surf() == "inflated" && m_surface.hemi() == 1)
117  this->translateTransform()->setDx(this->scaleTransform()->scale()/10);
118 
119  //Set material
120  QPerVertexColorMaterial *qperVertexColorMaterial = new QPerVertexColorMaterial();
121  this->addComponent(qperVertexColorMaterial);
122 
123 // QPhongMaterial *phongMaterial = new QPhongMaterial();
124 // phongMaterial->setDiffuse(QColor(40, 40, 40));
125 // phongMaterial->setAmbient(Qt::gray);
126 // phongMaterial->setSpecular(Qt::white);
127 // phongMaterial->setShininess(50.0f);
128 // this->addComponent(phongMaterial);
129 
130 // QDiffuseMapMaterial *diffuseMapMaterial = new QDiffuseMapMaterial();
131 // diffuseMapMaterial->setAmbient(Qt::gray);
132 // diffuseMapMaterial->setSpecular(Qt::white);
133 // diffuseMapMaterial->setShininess(5.0f);
134 // this->addComponent(diffuseMapMaterial);
135 }
136 
Holds the data of one hemisphere in form of a mesh.
Declaration of brain BrainHemisphere which holds the data of the right or left brain hemisphere in fo...
FreeSurfer surface mesh.
Definition: surface.h:92
qint32 hemi() const
Definition: surface.h:304
QString surf() const
Definition: surface.h:320