示例#1
0
def get_reader(format):
    "Return an image file reader for the specified format."
    readerspec = _readers.get(format)
    if readerspec is None:
        raise ValueError("Reader '%s' not found.  Avaliable readers are: %s"%\
          (format, ", ".join(available_readers)))
    return import_from(*readerspec)
示例#2
0
def get_reader(format):
    "Return an image file reader for the specified format."
    readerspec = _readers.get(format)
    if readerspec is None:
        raise ValueError("Reader '%s' not found.  Avaliable readers are: %s"%\
          (format, ", ".join(available_readers)))
    return import_from(*readerspec)
示例#3
0
def get_writer(format_type):
    "Return an image file writer method for the Recon output type"
    writerspec = _writers.get(format_type)
    if writerspec is None:
        raise ValueError("Writer method for '%s' not found. "\
                         "Avaliable writers are: %s"%\
                         (format_type, ", ".join(available_writers)))
    return import_from(*writerspec)
示例#4
0
def get_writer(format_type):
    "Return an image file writer method for the Recon output type"
    writerspec = _writers.get(format_type)
    if writerspec is None:
        raise ValueError("Writer method for '%s' not found. "\
                         "Avaliable writers are: %s"%\
                         (format_type, ", ".join(available_writers)))
    return import_from(*writerspec)
示例#5
0
def getToolByName(toolname):
    if not tool_map.has_key(toolname):
        raise ValueError("No tool called '%s'." % toolname)
    classname = tool_map[toolname]
    modulename = "recon.tools.%s" % classname
    try:
        return import_from(modulename, classname)
    except ImportError:
        raise RuntimeError("Tool class %s.%s not found." % (modulename, classname))
示例#6
0
def getToolByName(toolname):
    if not tool_map.has_key(toolname):
        raise ValueError("No tool called '%s'." % toolname)
    classname = tool_map[toolname]
    modulename = "recon.tools.%s" % classname
    try:
        return import_from(modulename, classname)
    except ImportError:
        raise RuntimeError("Tool class %s.%s not found." %
                           (modulename, classname))
示例#7
0
 def _get_operation_modules(self):
     """
     Find and import all modules in the recon.operation package.
     Return a list of the found module objects.
     """
     opfiles = glob(join(dirname(__file__), "*.py"))
     opmodules = []
     for opfile in opfiles:
         opmodname = basename(opfile).split(".")[0]
         full_opmodname = "recon.operations.%s"%opmodname
         opmodules.append((opmodname,
                           import_from(full_opmodname, opmodname)))
     return opmodules
示例#8
0
 def _get_operation_modules(self):
     """
     Find and import all modules in the recon.operation package.
     Return a list of the found module objects.
     """
     opfiles = glob(join(dirname(__file__), "*.py"))
     opmodules = []
     for opfile in opfiles:
         opmodname = basename(opfile).split(".")[0]
         full_opmodname = "recon.operations.%s" % opmodname
         opmodules.append((opmodname, import_from(full_opmodname,
                                                  opmodname)))
     return opmodules