def open_skeleton_file ( open, dialog, smod ) : if not open: return paths = dialog.getPaths() path = paths[0] import VolumePath g = VolumePath.open_marker_set(path) mlist = g.markers() for m in mlist: m.region = None rid = int(m.extra_attributes['region_id']) if rid in smod.id_to_region: r = smod.id_to_region[rid] rsize = int(m.extra_attributes['region_size']) if r.point_count() == rsize: m.region = r #TODO: The regions file format renumbers the regions consecutively. So # matching based on region id won't work. Should change file format to # hdf5 and include region ids, colors, and any other useful per-region info. nomatch = [m for m in mlist if m.region is None] if nomatch: umsg('%d of %d skeleton nodes did not match a region' % (len(nomatch), len(mlist))) if smod.adj_graph: smod.adj_graph.close() smod.adj_graph = g
def open_marker_set(path): import VolumePath VolumePath.open_marker_set(path) models = [] return models