41 #include "../../workers/rtSourceLoc/rtsourcedatacontroller.h"
42 #include "../common/metatreeitem.h"
43 #include "../common/abstractmeshtreeitem.h"
44 #include "../common/gpuinterpolationitem.h"
45 #include "../freesurfer/fssurfacetreeitem.h"
46 #include "../../3dhelpers/custommesh.h"
47 #include "../../materials/pervertexphongalphamaterial.h"
59 #include <Qt3DCore/QEntity>
71 using namespace Eigen;
72 using namespace MNELIB;
73 using namespace DISP3DLIB;
74 using namespace FSLIB;
75 using namespace FIFFLIB;
81 MneDataTreeItem::MneDataTreeItem(
int iType,
85 , m_bIsDataInit(false)
102 this->setCheckable(
true);
103 this->setCheckState(Qt::Checked);
104 this->setEditable(
false);
105 this->setToolTip(
"MNE Data item");
108 QList<QStandardItem*> list;
114 list << pItemStreamStatus;
115 list <<
new QStandardItem(pItemStreamStatus->toolTip());
116 this->appendRow(list);
117 pItemStreamStatus->setCheckable(
true);
118 pItemStreamStatus->setCheckState(Qt::Unchecked);
120 data.setValue(
false);
121 pItemStreamStatus->setData(data, MetaTreeItemRoles::StreamStatus);
123 QString defaultVisualizationType =
"Interpolation based";
124 MetaTreeItem* pItemVisuaizationType =
new MetaTreeItem(MetaTreeItemTypes::VisualizationType, defaultVisualizationType);
128 list << pItemVisuaizationType;
129 list <<
new QStandardItem(pItemVisuaizationType->toolTip());
130 this->appendRow(list);
131 data.setValue(defaultVisualizationType);
132 pItemVisuaizationType->setData(data, MetaTreeItemRoles::VisualizationType);
138 list << pItemColormapType;
139 list <<
new QStandardItem(pItemColormapType->toolTip());
140 this->appendRow(list);
141 data.setValue(QString(
"Hot"));
142 pItemColormapType->setData(data, MetaTreeItemRoles::ColormapType);
148 list << pItemSourceLocNormValue;
149 list <<
new QStandardItem(pItemSourceLocNormValue->toolTip());
150 this->appendRow(list);
151 data.setValue(QVector3D(0.0,5.5,15));
152 pItemSourceLocNormValue->setData(data, MetaTreeItemRoles::DataThreshold);
158 list << pItemStreamingInterval;
159 list <<
new QStandardItem(pItemStreamingInterval->toolTip());
160 this->appendRow(list);
162 pItemStreamingInterval->setData(data, MetaTreeItemRoles::StreamingTimeInterval);
167 pItemLoopedStreaming->setCheckable(
true);
168 pItemLoopedStreaming->setCheckState(Qt::Checked);
170 list << pItemLoopedStreaming;
171 list <<
new QStandardItem(pItemLoopedStreaming->toolTip());
172 this->appendRow(list);
178 list << pItemAveragedStreaming;
179 list <<
new QStandardItem(pItemAveragedStreaming->toolTip());
180 this->appendRow(list);
182 pItemAveragedStreaming->setData(data, MetaTreeItemRoles::NumberAverages);
198 list << pInterpolationFunction;
199 list <<
new QStandardItem(pInterpolationFunction->toolTip());
200 this->appendRow(list);
201 data.setValue(QString(
"Cubic"));
202 pInterpolationFunction->setData(data, MetaTreeItemRoles::InterpolationFunction);
210 Qt3DCore::QEntity* p3DEntityParent)
212 if(tForwardSolution.
src.
size() < 2 || tAnnotSet.
size() < 2 || tSurfSet.
size() < 2) {
213 qDebug() <<
"MneDataTreeItem::initData - Two hemisphere were not found. Check input.";
214 qDebug() <<
"MneDataTreeItem::initData - tForwardSolution.src.size(): "<<tForwardSolution.
src.
size();
215 qDebug() <<
"MneDataTreeItem::initData - tSurfSet.size(): "<<tSurfSet.
size();
216 qDebug() <<
"MneDataTreeItem::initData - tAnnotSet.size(): "<<tAnnotSet.
size();
221 bool isClustered = tForwardSolution.
src[0].isClustered();
223 VectorXi clustVertNoTemp, clustVertNoLeft, clustVertNoRight;
225 for(
int i = 0; i < tForwardSolution.
src.
size(); ++i) {
228 clustVertNoTemp.resize(tForwardSolution.
src[i].cluster_info.centroidVertno.
size());
229 for(
int j = 0; j < clustVertNoTemp.rows(); ++j) {
230 clustVertNoTemp(j) = tForwardSolution.
src[i].cluster_info.centroidVertno.at(j);
233 clustVertNoTemp = tForwardSolution.
src[i].vertno;
237 clustVertNoLeft = clustVertNoTemp;
239 clustVertNoRight = clustVertNoTemp;
244 QList<QStandardItem*> list;
247 QString sIsClustered = isClustered ?
"Clustered" :
"Full";
249 pItemSourceSpaceType->setEditable(
false);
251 list << pItemSourceSpaceType;
252 list <<
new QStandardItem(pItemSourceSpaceType->toolTip());
253 this->appendRow(list);
254 data.setValue(sIsClustered);
255 pItemSourceSpaceType->setData(data, MetaTreeItemRoles::SourceSpaceType);
258 QList<FSLIB::Label> qListLabelsLeft, qListLabelsRight;
259 QList<RowVector4i> qListLabelRGBAs;
261 VectorXi vecLabelIdsLeftHemi;
262 VectorXi vecLabelIdsRightHemi;
264 vecLabelIdsLeftHemi = tAnnotSet[0].getLabelIds();
265 vecLabelIdsRightHemi = tAnnotSet[1].getLabelIds();
266 tAnnotSet[0].
toLabels(tSurfSet[0], qListLabelsLeft, qListLabelRGBAs);
267 tAnnotSet[1].
toLabels(tSurfSet[1], qListLabelsRight, qListLabelRGBAs);
279 Data3DTreeModelItemTypes::GpuInterpolationItem,
280 QStringLiteral(
"3D Plot - Left"));
287 -tSurfSet[0].offset()(1),
288 -tSurfSet[0].offset()(2)));
290 QList<QStandardItem*> list;
293 this->appendRow(list);
301 Data3DTreeModelItemTypes::GpuInterpolationItem,
302 QStringLiteral(
"3D Plot - Right"));
309 -tSurfSet[1].offset()(1),
310 -tSurfSet[1].offset()(2)));
312 QList<QStandardItem*> list;
315 this->appendRow(list);
333 Data3DTreeModelItemTypes::AbstractMeshItem,
334 QStringLiteral(
"3D Plot - Left"));
340 Qt3DRender::QGeometryRenderer::Triangles);
343 -tSurfSet[0].offset()(1),
344 -tSurfSet[0].offset()(2)));
346 QList<QStandardItem*> list;
349 this->appendRow(list);
360 Data3DTreeModelItemTypes::AbstractMeshItem,
361 QStringLiteral(
"3D Plot - Right"));
367 Qt3DRender::QGeometryRenderer::Triangles);
370 -tSurfSet[1].offset()(1),
371 -tSurfSet[1].offset()(2)));
373 QList<QStandardItem*> list;
376 this->appendRow(list);
390 tForwardSolution.
src[1].rr,
391 tForwardSolution.
src[0].neighbor_vert,
392 tForwardSolution.
src[1].neighbor_vert,
400 vecLabelIdsRightHemi,
414 qDebug() <<
"MneDataTreeItem::addData - Item has not been initialized yet!";
420 data.setValue(tSourceEstimate.
data);
421 this->
setData(data, Data3DTreeModelItemRoles::Data);
433 QList<QStandardItem*> lItems = this->
findChildren(MetaTreeItemTypes::LoopedStreaming);
435 for(
int i = 0; i < lItems.size(); i++) {
437 pAbstractItem->setCheckState(state ==
true ? Qt::Checked : Qt::Unchecked);
439 data.setValue(state);
440 pAbstractItem->setData(data, MetaTreeItemRoles::LoopedStreaming);
449 QList<QStandardItem*> lItems = this->
findChildren(MetaTreeItemTypes::StreamStatus);
451 for(
int i = 0; i < lItems.size(); i++) {
453 pAbstractItem->setCheckState(state ==
true ? Qt::Checked : Qt::Unchecked);
455 data.setValue(state);
456 pAbstractItem->setData(data, MetaTreeItemRoles::StreamStatus);
465 QList<QStandardItem*> lItems = this->
findChildren(MetaTreeItemTypes::StreamingTimeInterval);
467 for(
int i = 0; i < lItems.size(); i++) {
470 data.setValue(iMSec);
471 pAbstractItem->setData(data, MetaTreeItemRoles::StreamingTimeInterval);
472 pAbstractItem->setData(data, Qt::DisplayRole);
481 QList<QStandardItem*> lItems = this->
findChildren(MetaTreeItemTypes::NumberAverages);
483 for(
int i = 0; i < lItems.size(); i++) {
486 data.setValue(iNumberAverages);
487 pAbstractItem->setData(data, MetaTreeItemRoles::NumberAverages);
488 pAbstractItem->setData(data, Qt::DisplayRole);
497 QList<QStandardItem*> lItems = this->
findChildren(MetaTreeItemTypes::ColormapType);
499 for(
int i = 0; i < lItems.size(); i++) {
502 data.setValue(sColormap);
503 pAbstractItem->setData(data, MetaTreeItemRoles::ColormapType);
504 pAbstractItem->setData(data, Qt::DisplayRole);
513 QList<QStandardItem*> lItems = this->
findChildren(MetaTreeItemTypes::VisualizationType);
515 for(
int i = 0; i < lItems.size(); i++) {
518 data.setValue(sVisualizationType);
519 pAbstractItem->setData(data, MetaTreeItemRoles::VisualizationType);
520 pAbstractItem->setData(data, Qt::DisplayRole);
529 QList<QStandardItem*> lItems = this->
findChildren(MetaTreeItemTypes::DataThreshold);
531 for(
int i = 0; i < lItems.size(); i++) {
534 data.setValue(vecThresholds);
535 pAbstractItem->setData(data, MetaTreeItemRoles::DataThreshold);
537 QString sTemp = QString(
"%1,%2,%3").arg(vecThresholds.x()).arg(vecThresholds.y()).arg(vecThresholds.z());
538 data.setValue(sTemp);
539 pAbstractItem->setData(data, Qt::DisplayRole);
564 QList<QStandardItem*> lItems = this->
findChildren(MetaTreeItemTypes::InterpolationFunction);
566 for(
int i = 0; i < lItems.size(); i++) {
569 data.setValue(sInterpolationFunction);
570 pAbstractItem->setData(data, MetaTreeItemRoles::InterpolationFunction);
571 pAbstractItem->setData(data, Qt::DisplayRole);
692 if(checkState == Qt::Checked) {
694 }
else if(checkState == Qt::Unchecked) {
703 const Eigen::MatrixX4f &matColorMatrixRightHemi)
737 const Eigen::VectorXd &vecDataVectorRightHemi)
752 if(sColormapType.canConvert<QString>()) {
773 if(iMSec.canConvert<
int>()) {
784 if(vecThresholds.canConvert<QVector3D>()) {
805 if(sVisType.canConvert<QString>()) {
806 int iVisType = Data3DTreeModelItemRoles::InterpolationBased;
808 if(sVisType.toString() ==
"Annotation based") {
809 iVisType = Data3DTreeModelItemRoles::AnnotationBased;
823 if(checkState == Qt::Checked) {
825 }
else if(checkState == Qt::Unchecked) {
835 if(iNumAvr.canConvert<
int>()) {
858 if(sInterpolationFunction.canConvert<QString>()) {