[ome-devel] command line importer
Will Moore
will at lifesci.dundee.ac.uk
Wed May 18 17:58:04 BST 2011
Hi Chris,
I didn't write this, and I'm not too familiar with the code, but this
is something we use in our Python testing framework to import images.
components/tools/OmeroPy/test/integration/libraray.py
def import_image(self, filename = None):
if filename is None:
filename = self.OmeroPy / ".." / ".." / ".." /
"components" / "common" / "test" / "tinyTest.d3d.dv"
server = self.client.getProperty("omero.host")
port = self.client.getProperty("omero.port")
key = self.client.getSessionId()
# Search up until we find "OmeroPy"
dist_dir = self.OmeroPy / ".." / ".." / ".." / "dist"
args = ["python"]
args.append(str(path(".") / "bin" / "omero"))
args.extend(["-s", server, "-k", key, "-p", port, "import",
filename])
popen = subprocess.Popen(args, cwd=str(dist_dir),
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = popen.communicate()
rc = popen.wait()
if rc != 0:
raise exceptions.Exception("import failed: [%r] %s\n%s" %
(args, rc, err))
pix_ids = []
for x in out.split("\n"):
if x and x.find("Created") < 0 and x.find("#") < 0:
try: # if the line has an image ID...
imageId = str(long(x.strip()))
pix_ids.append(imageId)
except: pass
return pix_ids
Hopefully you can work out what you need from this.
Will.
On 18 May 2011, at 17:16, Wood, Christopher wrote:
> Also, when I use the command line importer (using the python
> subprocess module), is there a good way to get the image id?
>
> Thanks again.
> Chris
>
> From: ome-devel-bounces at lists.openmicroscopy.org.uk [mailto:ome-devel-bounces at lists.openmicroscopy.org.uk
> ] On Behalf Of Wood, Christopher
> Sent: Wednesday, May 18, 2011 11:10 AM
> To: ome-devel at lists.openmicroscopy.org.uk
> Subject: [ome-devel] command line importer
>
> Hi,
>
> Is there an option for the command line importer to archive the
> imported file(s) (so the originals can be downloaded later)?
>
> Thanks
> Chris
>
> --
> Chris Wood, Ph.D | Group Head - Stowers Microscopy Center
> Stowers Institute for Medical Research
> 1000 E 50th |Kansas City, MO 64110
> http://www.stowers.org | cjw at stowers.org
>
> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
William Moore
Wellcome Trust Centre for Gene Regulation & Expression
College of Life Sciences
MSI/WTB/JBC Complex
University of Dundee
Dow Street
Dundee DD1 5EH
United Kingdom
Phone 01382 386364
http://openmicroscopy.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20110518/d5124eff/attachment-0001.html>
More information about the ome-devel
mailing list