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 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