Beispiel #1
0
bool MeasurementTreeItem::addData(const SurfaceSet& tSurfaceSet, const AnnotationSet& tAnnotationSet, Qt3DCore::QEntity* p3DEntityParent)
{
    //Generate child items based on surface set input parameters
    bool state = false;

    QList<QStandardItem*> itemList = this->findChildren(Data3DTreeModelItemTypes::HemisphereItem);

    //If there are more hemispheres in tSourceSpace than in the tree model
    bool hemiItemFound = false;

    //Search for already created hemi items and add source space data respectivley
    for(int i = 0; i < tSurfaceSet.size(); ++i) {
        for(int j = 0; j < itemList.size(); ++j) {
            if(BrainHemisphereTreeItem* pHemiItem = dynamic_cast<BrainHemisphereTreeItem*>(itemList.at(j))) {
                if(pHemiItem->data(Data3DTreeModelItemRoles::SurfaceHemi).toInt() == tSurfaceSet[i].hemi()) {
                    hemiItemFound = true;

                    if(i < tAnnotationSet.size()) {
                        if(tAnnotationSet[i].hemi() == tSurfaceSet[i].hemi()) {
                            state = pHemiItem->addData(tSurfaceSet[i], tAnnotationSet[i], p3DEntityParent);
                        } else {
                            state = pHemiItem->addData(tSurfaceSet[i], Annotation(), p3DEntityParent);
                        }
                    } else {
                        state = pHemiItem->addData(tSurfaceSet[i], Annotation(), p3DEntityParent);
                    }
                }
            }
        }

        if(!hemiItemFound) {
            //Item does not exist yet, create it here.
            BrainHemisphereTreeItem* pHemiItem = new BrainHemisphereTreeItem(Data3DTreeModelItemTypes::HemisphereItem);            

            QList<QStandardItem*> list;
            list << pHemiItem;
            list << new QStandardItem(pHemiItem->toolTip());
            this->appendRow(list);

            if(i < tAnnotationSet.size()) {
                if(tAnnotationSet[i].hemi() == tSurfaceSet[i].hemi()) {
                    state = pHemiItem->addData(tSurfaceSet[i], tAnnotationSet[i], p3DEntityParent);
                } else {
                    state = pHemiItem->addData(tSurfaceSet[i], Annotation(), p3DEntityParent);
                }
            } else {
                state = pHemiItem->addData(tSurfaceSet[i], Annotation(), p3DEntityParent);
            }

            connect(pHemiItem->getSurfaceItem(), &BrainSurfaceTreeItem::colorInfoOriginChanged,
                this, &MeasurementTreeItem::onColorInfoOriginChanged);
        }

        hemiItemFound = false;
    }

    return state;
}
bool BrainSurfaceSetTreeItem::addData(const SurfaceSet& tSurfaceSet, const AnnotationSet& tAnnotationSet, Qt3DCore::QEntity* p3DEntityParent)
{
    //Generate child items based on surface set input parameters
    bool state = false;

    QList<QStandardItem*> itemList = this->findChildren(BrainTreeModelItemTypes::HemisphereItem);

    //If there are more hemispheres in tSourceSpace than in the tree model
    bool hemiItemFound = false;

    //Search for already created hemi items and add source space data respectivley
    for(int i = 0; i < tSurfaceSet.size(); i++) {
        for(int j = 0; j<itemList.size(); j++) {
            BrainHemisphereTreeItem* pHemiItem = dynamic_cast<BrainHemisphereTreeItem*>(itemList.at(j));

            if(pHemiItem->data(BrainHemisphereTreeItemRoles::SurfaceHemi).toInt() == tSurfaceSet[i].hemi()) {
                hemiItemFound = true;

                if(i < tAnnotationSet.size()) {
                    if(tAnnotationSet[i].hemi() == tSurfaceSet[i].hemi()) {
                        state = pHemiItem->addData(tSurfaceSet[i], tAnnotationSet[i], p3DEntityParent);
                    } else {
                        state = pHemiItem->addData(tSurfaceSet[i], Annotation(), p3DEntityParent);
                    }
                } else {
                    state = pHemiItem->addData(tSurfaceSet[i], Annotation(), p3DEntityParent);
                }
            }
        }

        if(!hemiItemFound) {
            //Item does not exist yet, create it here.
            BrainHemisphereTreeItem* pHemiItem = new BrainHemisphereTreeItem(BrainTreeModelItemTypes::HemisphereItem);

            if(i < tAnnotationSet.size()) {
                if(tAnnotationSet[i].hemi() == tSurfaceSet[i].hemi()) {
                    state = pHemiItem->addData(tSurfaceSet[i], tAnnotationSet[i], p3DEntityParent);
                } else {
                    state = pHemiItem->addData(tSurfaceSet[i], Annotation(), p3DEntityParent);
                }
            } else {
                state = pHemiItem->addData(tSurfaceSet[i], Annotation(), p3DEntityParent);
            }

            *this<<pHemiItem; //same as this->appendRow(pSurfaceItem)
        }

        hemiItemFound = false;
    }

    return state;
}
Beispiel #3
0
QList<FsSurfaceTreeItem*> Data3DTreeModel::addSurfaceSet(const QString& sSubject, const QString& sMriSetName, const SurfaceSet& surfaceSet, const AnnotationSet& annotationSet)
{
    QList<FsSurfaceTreeItem*> returnItemList;

    for(int i = 0; i < surfaceSet.size(); ++i) {
        if(i < annotationSet.size()) {
            returnItemList.append(addSurface(sSubject, sMriSetName, surfaceSet[i], annotationSet[i]));
        } else {
            returnItemList.append(addSurface(sSubject, sMriSetName,surfaceSet[i], Annotation()));
        }
    }

    return returnItemList;
}
Beispiel #4
0
QList<FsSurfaceTreeItem*> MriTreeItem::addData(const SurfaceSet& tSurfaceSet, const AnnotationSet& tAnnotationSet, Qt3DCore::QEntity* p3DEntityParent)
{
    //Generate child items based on surface set input parameters
    QList<FsSurfaceTreeItem*> returnItemList;

    //Search for already created hemi items and add source space data respectivley
    for(int i = 0; i < tSurfaceSet.size(); ++i) {
        if(i < tAnnotationSet.size()) {
            returnItemList.append(addData(tSurfaceSet[i], tAnnotationSet[i], p3DEntityParent));
        } else {
            returnItemList.append(addData(tSurfaceSet[i], Annotation(), p3DEntityParent));
        }
    }

    return returnItemList;
}