<div dir="ltr">Dropbox documentation says NAS is not supported, is a NFS mount considered a network attached share (NAS) to OMERO?<div><br></div><div>Dropbox import new images under "Orphaned Images", then user has to login to organize new images into projects and datasets, is that correct?</div><div><br></div><div>Thanks,</div><div>Yanling</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 26, 2014 at 8:38 AM, Aleksandra Tarkowska <span dir="ltr"><<a href="mailto:A.Tarkowska@dundee.ac.uk" target="_blank">A.Tarkowska@dundee.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Yanling<br>
<br>
As Carne mentioned you can invoke import process via python script.<br>
Similar test is available on<br>
<a href="https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/to
ols/OmeroPy/test/integration/library.py#L187" target="_blank">https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/to<br>
ols/OmeroPy/test/integration/library.py#L187</a><br>
<br>
args.extend(["-s", server, "-k", key, "-p", port, "import", "--"])<br>
<br>
Allows you to pass all parameters you normally pass via bin/omero import Š<br>
For more details refer to --help.<br>
<br>
Can I ask why you just simply cannot use dropbox to do that work<br>
automatically for you?<br>
Did you see<br>
<a href="http://www.openmicroscopy.org/site/support/omero5/sysadmins/dropbox.html" target="_blank">http://www.openmicroscopy.org/site/support/omero5/sysadmins/dropbox.html</a><br>
<br>
Kind regards<br>
Ola<br>
<div><div class="h5"><br>
<br>
<br>
<br>
<br>
On 26/09/2014 12:48, "Carnë Draug" <<a href="mailto:carandraug%2Bdev@gmail.com">carandraug+dev@gmail.com</a>> wrote:<br>
<br>
>On Thu, 25 Sep 2014 13:31:53 -0400, Yanling Liu <<a href="mailto:vrnova@gmail.com">vrnova@gmail.com</a>> wrote:<br>
>> Hi,<br>
>><br>
>> I was able to use the CLI import (bin/omero import) to import<br>
>> images into OMERO. My question is that if OMERO python binding has<br>
>> similar capability? Can I write a little python script and call OMERO<br>
>> import function to upload some images to OMERO?<br>
>><br>
>> What I mean is if there's python binding to the import function,<br>
>> rather than doing system call in python script to call bin/omero.<br>
><br>
>You can do something like the following:<br>
><br>
> import omero<br>
> import omero.cli<br>
><br>
> client = omero.client (host = server_ip_or_hostname)<br>
> client.createSession (username = "username", password = "password")<br>
><br>
> cli = omero.cli.CLI()<br>
> cli.loadplugins()<br>
> cli._client = client.createClient(secure = True)<br>
> cli.invoke(["import", path_to_image_file])<br>
><br>
>Note that you need to create a copy of the client when setting `_client`<br>
>because that session will be closed after the image import.<br>
><br>
>To find out the ID of the image you imported, you will need to get<br>
>this call STDOUT. I have routinely [1] been doing the following (note<br>
>that this imports a single file but should be easy to adjust for<br>
>multiple files):<br>
><br>
><br>
> cli = omero.cli.CLI()<br>
> cli.loadplugins()<br>
> cli._client = self.client.createClient(secure = True)<br>
> cmd = [<br>
> "import",<br>
> "--debug", "ERROR",<br>
> ]<br>
> if self.datasetID:<br>
> cmd.extend(["-d", str(self.datasetID)])<br>
> if self.child_name:<br>
> cmd.extend(["-n", self.child_name])<br>
><br>
> cid = None<br>
> with tempfile.NamedTemporaryFile(suffix=".stdout") as stdout:<br>
> cmd.extend([<br>
> "---errs", os.devnull,<br>
> "---file", <a href="http://stdout.name" target="_blank">stdout.name</a>,<br>
> ])<br>
> cmd.append(<a href="http://self.fout.name" target="_blank">self.fout.name</a>)<br>
><br>
> STDERR = sys.stderr<br>
> try:<br>
> with open(os.devnull, 'w') as DEVNULL:<br>
> sys.stderr = DEVNULL<br>
> cli.invoke(cmd)<br>
> finally:<br>
> sys.stderr = STDERR<br>
> ret_code = cli.rv<br>
> if ret_code == 0:<br>
> ## we only need to read one line or something is very wrong<br>
> cid = int(stdout.readline())<br>
> if not cid:<br>
> raise Exception("unable to get exported image ID")<br>
> else:<br>
> raise Exception("failed to import processed image")<br>
><br>
> self.child = self.conn.getObject("Image", cid)<br>
><br>
><br>
>[1]<br>
><a href="https://github.com/MicronOxford/omero_scripts_processing/blob/40e29af8/ome" target="_blank">https://github.com/MicronOxford/omero_scripts_processing/blob/40e29af8/ome</a><br>
>ro_scripts_processing.py#L293<br>
</div></div>>_______________________________________________<br>
>ome-devel mailing list<br>
><a href="mailto:ome-devel@lists.openmicroscopy.org.uk">ome-devel@lists.openmicroscopy.org.uk</a><br>
><a href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel" target="_blank">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel</a><br>
<br>
<br>
The University of Dundee is a registered Scottish Charity, No: SC015096<br>
</blockquote></div><br></div>