本文整理汇总了Python中omero.cli.CLI.loadplugins方法的典型用法代码示例。如果您正苦于以下问题:Python CLI.loadplugins方法的具体用法?Python CLI.loadplugins怎么用?Python CLI.loadplugins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类omero.cli.CLI
的用法示例。
在下文中一共展示了CLI.loadplugins方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check
# 需要导入模块: from omero.cli import CLI [as 别名]
# 或者: from omero.cli.CLI import loadplugins [as 别名]
def check(self):
from omero.cli import CLI
from omero.gateway import BlitzGateway
cli = CLI()
cli.loadplugins()
cli.onecmd('login -q')
try:
gateway = BlitzGateway(client_obj=cli.get_client())
for experiment in self.m["experiments"]:
self.check_object(gateway, experiment, "Project")
for experiment in self.m["screens"]:
self.check_object(gateway, experiment, "Screen")
if "map" in self.m:
if self.m["experiments"]:
study_type = "Project"
else:
study_type = "Screen"
self.check_object(gateway, self.m, study_type)
finally:
if cli:
cli.close()
gateway.close()
示例2: main
# 需要导入模块: from omero.cli import CLI [as 别名]
# 或者: from omero.cli.CLI import loadplugins [as 别名]
def main():
parser = Parser()
parser.add_login_arguments()
parser.add_argument("--orphans", action="store_true")
parser.add_argument("--unknown", action="store_true")
parser.add_argument("--search", action="store_true")
parser.add_argument("--images", action="store_true")
parser.add_argument("--copy-from", type=long, default=None)
parser.add_argument("--copy-type", default="Image")
parser.add_argument("--copy-to", type=long, default=None)
parser.add_argument("screen", nargs="?")
ns = parser.parse_args()
cli = CLI()
cli.loadplugins()
client = cli.conn(ns)
try:
query = client.sf.getQueryService()
if ns.orphans:
orphans(query)
elif ns.unknown:
unknown(query)
elif ns.search:
search = client.sf.createSearchService()
check_search(query, search)
elif not ns.screen:
stat_screens(query)
else:
if ns.copy_to:
copy(client, ns.copy_from, ns.copy_type, ns.copy_to)
else:
for x in stat_plates(query, ns.screen, ns.images):
print x
finally:
cli.close()
示例3: T
# 需要导入模块: from omero.cli import CLI [as 别名]
# 或者: from omero.cli.CLI import loadplugins [as 别名]
class T(Thread):
def run(self, *args):
pause = random.random()
event.wait(pause)
self.cli = CLI()
self.cli.loadplugins()
self.con = self.cli.controls["admin"]
self.cmp = self.con.ctx
示例4: as_stdout
# 需要导入模块: from omero.cli import CLI [as 别名]
# 或者: from omero.cli.CLI import loadplugins [as 别名]
def as_stdout(path, readers=""):
path = _to_list(path)
readers = str(readers)
cli = CLI()
cli.loadplugins()
if readers:
cli.invoke(["import", "-l", readers, "-f"]+path)
else:
cli.invoke(["import", "-f"]+path)
if cli.rv != 0:
raise omero.InternalException(None, None, "'import -f' exited with a rc=%s. See console for more information" % cli.rv)
示例5: main
# 需要导入模块: from omero.cli import CLI [as 别名]
# 或者: from omero.cli.CLI import loadplugins [as 别名]
def main():
parser = Parser()
parser.add_login_arguments()
parser.add_argument("file")
parser.add_argument("object")
ns = parser.parse_args()
cli = CLI()
cli.loadplugins()
client = cli.conn(ns)
try:
screen_metadata(client, ns.file, ns.object)
finally:
cli.close()
示例6: status
# 需要导入模块: from omero.cli import CLI [as 别名]
# 或者: from omero.cli.CLI import loadplugins [as 别名]
def status(self, args):
self.ctx.invoke(["admin", "status", args.name])
def stop(self, args):
if self._isWindows():
try:
command = ["icegridnode", "--stop", "OMERO."+args.name]
self.ctx.call(command)
command = ["icegridnode", "--uninstall", "OMERO."+args.name]
self.ctx.call(command)
except NonZeroReturnCode, nzrc:
self._handleNZRC(nzrc)
else:
pid = open(self._pid(), "r").readline()
os.kill(int(pid), signal.SIGTERM)
# command = ["icegridadmin"] + [self._intcfg()] + ["-c", "node
# shutdown %s" % args.name]
# self.ctx.call(command)
def kill(self, args):
pid = open(self._pid(), "r").readline()
os.kill(int(pid), signal.SIGKILL)
try:
register("node", NodeControl, HELP)
except NameError:
if __name__ == "__main__":
cli = CLI()
cli.loadplugins()
cli.invoke(sys.argv[1:])
示例7: hrm_to_omero
# 需要导入模块: from omero.cli import CLI [as 别名]
# 或者: from omero.cli.CLI import loadplugins [as 别名]
def hrm_to_omero(conn, id_str, image_file):
"""Upload an image into a specific dataset in OMERO.
In case we know from the suffix that a given file format is not supported
by OMERO, the upload will not be initiated at all (e.g. for SVI-HDF5,
having the suffix '.h5').
The import itself is done by instantiating the CLI class, assembling the
required arguments, and finally running cli.invoke(). This eventually
triggers the importer() method defined in OMERO's Python bindings in
<OMERO.server/lib/python/omero/plugins/import.py>, respectively (source)
<openmicroscopy.git/components/tools/OmeroPy/src/omero/plugins/import.py>.
Parameters
==========
id_str: str - the ID of the target dataset in OMERO (e.g. "G:7:Dataset:23")
image_file: str - the local image file including the full path
Returns
=======
True in case of success, False otherwise.
"""
if image_file.lower().endswith(('.h5', '.hdf5')):
print 'ERROR: HDF5 files are not supported by OMERO!'
return False
# TODO I: group switching required!!
_, gid, obj_type, dset_id = id_str.split(':')
# we have to create the annotations *before* we actually upload the image
# data itself and link them to the image during the upload - the other way
# round is not possible right now as the CLI wrapper (see below) doesn't
# expose the ID of the newly created object in OMERO (confirmed by J-M and
# Sebastien on the 2015 OME Meeting):
namespace = 'deconvolved.hrm'
#### mime = 'text/plain'
# extract the image basename without suffix:
# TODO: is it [0-9a-f] or really [0-9a-z] as in the original PHP code?
basename = re.sub(r'(_[0-9a-f]{13}_hrm)\..*', r'\1', image_file)
comment = gen_parameter_summary(basename + '.parameters.txt')
#### annotations = []
#### # TODO: the list of suffixes should not be hardcoded here!
#### for suffix in ['.hgsb', '.log.txt', '.parameters.txt']:
#### if not os.path.exists(basename + suffix):
#### continue
#### ann = conn.createFileAnnfromLocalFile(
#### basename + suffix, mimetype=mime, ns=namespace, desc=None)
#### annotations.append(ann.getId())
# currently there is no direct "Python way" to import data into OMERO, so
# we have to use the CLI wrapper for this:
from omero.cli import CLI
cli = CLI()
cli.loadplugins()
# NOTE: cli._client should be replaced with cli.set_client() when switching
# to support for OMERO 5.1 and later only:
cli._client = conn.c
import_args = ["import"]
import_args.extend(['-d', dset_id])
if comment is not None:
import_args.extend(['--annotation_ns', namespace])
import_args.extend(['--annotation_text', comment])
#### for ann_id in annotations:
#### import_args.extend(['--annotation_link', str(ann_id)])
import_args.append(image_file)
# print("import_args: " + str(import_args))
try:
cli.invoke(import_args, strict=True)
except:
print('ERROR: uploading "%s" to %s failed!' % (image_file, id_str))
# print(import_args)
return False
return True