65 #include <QSharedPointer>
66 #include <Qt3DCore/QEntity>
67 #include <QSurfaceFormat>
77 using namespace FSLIB;
78 using namespace MNELIB;
79 using namespace DISP3DLIB;
80 using namespace INVERSELIB;
81 using namespace CONNECTIVITYLIB;
82 using namespace Eigen;
83 using namespace FIFFLIB;
89 Data3DTreeModel::Data3DTreeModel(QObject* parent)
90 : QStandardItemModel(parent)
91 , m_pModelEntity(new Qt3DCore::QEntity())
112 return QStandardItemModel::data(index, role);
117 int Data3DTreeModel::columnCount(
const QModelIndex &parent)
const
126 QVariant Data3DTreeModel::headerData(
int section, Qt::Orientation orientation,
129 if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
132 data.setValue(QString(
"Data"));
133 }
else if(section == 1) {
134 data.setValue(QString(
"Description"));
145 Qt::ItemFlags Data3DTreeModel::flags(
const QModelIndex &index)
const
148 if(index.column() == 1) {
149 return Qt::ItemIsEnabled;
152 return QStandardItemModel::flags(index);
158 const QString& sMriSetName,
162 QList<FsSurfaceTreeItem*> returnItemList;
164 for(
int i = 0; i < surfaceSet.
size(); ++i) {
165 if(i < annotationSet.
size()) {
166 returnItemList.append(
addSurface(sSubject, sMriSetName, surfaceSet[i], annotationSet[i]));
172 return returnItemList;
178 const QString& sMriSetName,
188 QList<QStandardItem*> itemList = pSubjectItem->
findChildren(sMriSetName);
190 if(!itemList.isEmpty()) {
205 const QString& sMeasurementSetName,
208 QList<SourceSpaceTreeItem*> pReturnItem;
214 QList<QStandardItem*> itemList = pSubjectItem->
findChildren(sMeasurementSetName);
216 if(!itemList.isEmpty()) {
231 const QString& sMeasurementSetName,
240 const QString& sMeasurementSetName,
246 bool bUseGPU =
false;
260 QList<QStandardItem*> itemList = pSubjectItem->
findChildren(sMeasurementSetName);
263 if(!itemList.isEmpty() && (itemList.first()->type() == Data3DTreeModelItemTypes::MeasurementItem)) {
265 pReturnItem = pMeasurementItem->
addData(tSourceEstimate,
275 pReturnItem = pMeasurementItem->
addData(tSourceEstimate,
298 QList<QStandardItem*> itemList = pSubjectItem->
findChildren(sSet);
301 if(!itemList.isEmpty() && (itemList.first()->type() == Data3DTreeModelItemTypes::MeasurementItem)) {
317 const QString& sMeasurementSetName,
318 const QList<Network>& networkData)
320 QList<NetworkTreeItem*> returnList;
322 for(
int i = 0; i < networkData.size(); ++i) {
334 const QString& sMeasurementSetName,
343 QList<QStandardItem*> itemList = pSubjectItem->
findChildren(sMeasurementSetName);
345 if(!itemList.isEmpty() && (itemList.first()->type() == Data3DTreeModelItemTypes::MeasurementItem)) {
361 const QString& sBemSetName,
370 QList<QStandardItem*> itemList = pSubjectItem->
findChildren(sBemSetName);
372 if(!itemList.isEmpty() && (itemList.first()->type() == Data3DTreeModelItemTypes::BemItem)) {
373 pReturnItem =
dynamic_cast<BemTreeItem*
>(itemList.first());
376 pReturnItem =
new BemTreeItem(Data3DTreeModelItemTypes::BemItem, sBemSetName);
387 const QString& sSensorSetName,
388 const QList<FIFFLIB::FiffChInfo>& lChInfo,
390 const QStringList& bads)
398 QList<QStandardItem*> itemList = pSubjectItem->
findChildren(sSensorSetName);
400 if(!itemList.isEmpty() && (itemList.first()->type() == Data3DTreeModelItemTypes::SensorSetItem)) {
402 if(pReturnItem == Q_NULLPTR){
403 qDebug()<<
"Dynamic cast failed, returning null pointer";
408 pReturnItem =
new SensorSetTreeItem(Data3DTreeModelItemTypes::SensorSetItem, sSensorSetName);
419 const QString& sSensorSetName,
420 const QList<FIFFLIB::FiffChInfo>& lChInfo,
421 const QStringList& bads)
429 QList<QStandardItem*> itemList = pSubjectItem->
findChildren(sSensorSetName);
433 if(!itemList.isEmpty() && (itemList.first()->type() == Data3DTreeModelItemTypes::SensorSetItem)) {
435 if(pReturnItem == Q_NULLPTR){
436 qDebug() <<
"Dynamic cast failed, returning null pointer";
437 pReturnItem = Q_NULLPTR;
442 pReturnItem =
new SensorSetTreeItem(Data3DTreeModelItemTypes::SensorSetItem, sSensorSetName);
453 const QString& sMeasurementSetName,
462 QList<QStandardItem*> itemList = pSubjectItem->
findChildren(sMeasurementSetName);
464 if(!itemList.isEmpty() && (itemList.first()->type() == Data3DTreeModelItemTypes::MeasurementItem)) {
479 const QString& sMeasurementSetName,
480 const MatrixXd& matSensorData,
483 const QString& sDataType)
485 bool bUseGPU =
false;
499 QList<QStandardItem*> itemList = pSubjectItem->
findChildren(sMeasurementSetName);
502 if(!itemList.isEmpty() && (itemList.first()->type() == Data3DTreeModelItemTypes::MeasurementItem)) {
504 pReturnItem = pMeasurementItem->
addData(matSensorData,
514 pReturnItem = pMeasurementItem->
addData(matSensorData,
539 QList<QStandardItem*> itemSubjectList = this->findItems(sSubject);
542 if(itemSubjectList.size() == 0) {
543 pReturnItem =
new SubjectTreeItem(Data3DTreeModelItemTypes::SubjectItem, sSubject);
544 itemSubjectList << pReturnItem;
545 itemSubjectList <<
new QStandardItem(pReturnItem->toolTip());
559 qRegisterMetaType<QVector<QVector<int> > >();
560 qRegisterMetaType<QVector<int> >();
562 qRegisterMetaType<QVector<Vector3f> >();
563 qRegisterMetaType<QVector<Eigen::Vector3f> >();
565 qRegisterMetaType<QList<FSLIB::Label> >();
566 qRegisterMetaType<QList<Label> >();
568 qRegisterMetaType<FIFFLIB::FiffInfo>();
569 qRegisterMetaType<FiffInfo>();
571 qRegisterMetaType<Eigen::MatrixX3i>();
572 qRegisterMetaType<MatrixX3i>();
574 qRegisterMetaType<Eigen::MatrixXd>();
575 qRegisterMetaType<MatrixXd>();
577 qRegisterMetaType<Eigen::MatrixX3f>();
578 qRegisterMetaType<MatrixX3f>();
580 qRegisterMetaType<Eigen::MatrixX4f>();
581 qRegisterMetaType<MatrixX4f>();
583 qRegisterMetaType<Eigen::VectorXf>();
584 qRegisterMetaType<VectorXf>();
586 qRegisterMetaType<Eigen::VectorXi>();
587 qRegisterMetaType<VectorXi>();
589 qRegisterMetaType<Eigen::VectorXd>();
590 qRegisterMetaType<VectorXd>();
592 qRegisterMetaType<Eigen::RowVectorXf>();
593 qRegisterMetaType<RowVectorXf>();
595 qRegisterMetaType<Eigen::Vector3f>();
596 qRegisterMetaType<Vector3f>();
598 qRegisterMetaType<Eigen::SparseMatrix<float> >();
599 qRegisterMetaType<SparseMatrix<float> >();
601 qRegisterMetaType<QSharedPointer<Eigen::SparseMatrix<float> > >();
602 qRegisterMetaType<QSharedPointer<SparseMatrix<float> > >();