예제 #1
0
def recoverTSFromObj(child_obj, protocol):
    p = protocol.getProject()
    graph = p.getSourceGraph(False)
    relations = p.mapper.getRelationsByName(RELATION_SOURCE)
    n = graph.getNode(child_obj.strId())
    connection = []
    while n is not None and not n.getParent().isRoot():
        n = n.getParent()
        connection.append(n.pointer.getUniqueId())
        connection.append(n.pointer.get().strId())
    for rel in relations:
        pObj = p.getObject(rel[OBJECT_PARENT_ID])
        pExt = rel['object_parent_extended']
        pp = Pointer(pObj, extended=pExt)
        if pp.getUniqueId() in connection:
            if isinstance(pObj, SetOfTiltSeries) and pObj.getFirstItem().getFirstItem().hasTransform():
                return pObj
    raise ValueError('Could not find any SetOfTiltSeries associated to %s.' % type(child_obj))