예제 #1
0
bool BrainSurfaceSetTreeItem::addData(const MNESourceSpace& tSourceSpace, 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 < tSourceSpace.size(); i++) {
        for(int j = 0; j<itemList.size(); j++) {
            BrainHemisphereTreeItem* pHemiItem = dynamic_cast<BrainHemisphereTreeItem*>(itemList.at(j));

            if(pHemiItem->data(BrainHemisphereTreeItemRoles::SurfaceHemi).toInt() == i) {
                hemiItemFound = true;
                state = pHemiItem->addData(tSourceSpace[i], p3DEntityParent);
            }
        }

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

            state = pHemisphereItem->addData(tSourceSpace[i], p3DEntityParent);

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

        hemiItemFound = false;
    }

    return state;
}
예제 #2
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;
}
예제 #3
0
bool BrainSurfaceSetTreeItem::addData(const Surface& tSurface, const Annotation& tAnnotation, Qt3DCore::QEntity* p3DEntityParent)
{
    //Generate child items based on surface set input parameters
    bool state = false;

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

    bool hemiItemFound = false;

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

        if(pHemiItem->data(BrainHemisphereTreeItemRoles::SurfaceHemi).toInt() == tSurface.hemi()) {
            hemiItemFound = true;

            if(tAnnotation.hemi() == tSurface.hemi()) {
                state = pHemiItem->addData(tSurface, tAnnotation, p3DEntityParent);
            } else {
                state = pHemiItem->addData(tSurface, Annotation(), p3DEntityParent);
            }
        }
    }

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

        if(tAnnotation.hemi() == tSurface.hemi()) {
            state = pHemiItem->addData(tSurface, tAnnotation, p3DEntityParent);
        } else {
            state = pHemiItem->addData(tSurface, Annotation(), p3DEntityParent);
        }

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

    return state;
}