def parse(filename): name, ext = os.path.splitext(filename) if (ext == ".gz" or ext == ".bz2"): name, ext = os.path.splitext(name) if (ext == ".idl"): return parseIDL(filename) if (ext == ".al"): return parseXML(filename) if (ext == ".pal"): return PalLib.pal2al(PalLib.loadPal(filename)) return []
def parse(filename): name, ext = os.path.splitext(filename) if (ext == ".gz" or ext == ".bz2"): name, ext = os.path.splitext(name) if(ext == ".idl"): return parseIDL(filename) if(ext == ".al"): return parseXML(filename) if(ext == ".pal"): return PalLib.pal2al(PalLib.loadPal(filename)); return []
def save(filename, annotations): name, ext = os.path.splitext(filename) if (ext == ".gz" or ext == ".bz2"): name, ext = os.path.splitext(name) if (ext == ".idl"): return saveIDL(filename, annotations) elif (ext == ".al"): return saveXML(filename, annotations) elif (ext == ".pal"): return PalLib.savePal(filename, PalLib.al2pal(annotations)) else: assert (False) return False
def save(filename, annotations): name, ext = os.path.splitext(filename) if (ext == ".gz" or ext == ".bz2"): name, ext = os.path.splitext(name) if(ext == ".idl"): return saveIDL(filename, annotations) elif(ext == ".al"): return saveXML(filename, annotations) elif(ext == ".pal"): return PalLib.savePal(filename, PalLib.al2pal(annotations)); else: assert(False); return False;
def parse(filename, abs_path=False): #print "Parsing: ", filename name, ext = os.path.splitext(filename) if (ext == ".gz" or ext == ".bz2"): name, ext = os.path.splitext(name) if (ext == ".idl"): annolist = parseIDL(filename) elif (ext == ".al"): annolist = parseXML(filename) elif (ext == ".pal"): annolist = PalLib.pal2al(PalLib.loadPal(filename)) else: annolist = AnnoList([]) if abs_path: basedir = os.path.dirname(os.path.abspath(filename)) for a in annolist: a.imageName = basedir + "/" + os.path.basename(a.imageName) return annolist
def parse(filename, abs_path=False): #print "Parsing: ", filename name, ext = os.path.splitext(filename) if (ext == ".gz" or ext == ".bz2"): name, ext = os.path.splitext(name) if(ext == ".idl"): annolist = parseIDL(filename) elif(ext == ".al"): annolist = parseXML(filename) elif(ext == ".pal"): annolist = PalLib.pal2al(PalLib.loadPal(filename)); else: annolist = AnnoList([]); if abs_path: basedir = os.path.dirname(os.path.abspath(filename)) for a in annolist: a.imageName = basedir + "/" + os.path.basename(a.imageName) return annolist
def save(filename, annotations): print "saving: ", filename; name, ext = os.path.splitext(filename) if (ext == ".gz" or ext == ".bz2"): name, ext = os.path.splitext(name) if(ext == ".idl"): return saveIDL(filename, annotations) elif(ext == '.json'): return saveJSON(filename, annotations) elif(ext == ".al"): return saveXML(filename, annotations) elif(ext == ".pal"): return PalLib.savePal(filename, PalLib.al2pal(annotations)); else: assert(False); return False;