<html><head><base href="x-msg://2993/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi John,<div><br></div><div> A very similar question was asked a while back, so I'll paste the discussion below...</div><div><br></div><div>I suggested using a Python script to do the uploading and the subsequent attachment.</div><div><br></div><div>I don't have a complete working example, but hopefully there's enough info to get you started.</div><div><br></div><div>Perhaps Graeme might have the code that he developed as a solution to this?</div><div><br></div><div> Cheers,</div><div><br></div><div> Will.</div><div><br></div><div><br></div><div><br><div><div>On 10 Dec 2013, at 10:26, John Webber (NBI) wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div lang="EN-GB" link="#0563C1" vlink="#954F72"><div class="WordSection1" style="page: WordSection1; "><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">Hi all,<o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">I have been using the command line importer to import images into an Omero instance as follows: <o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; text-indent: 36pt; ">bin/omero -s $RemoteHost -u "$User" -w "$Password" -p $Port import -d $Dataset $File<o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">Can anyone let me know if I can also use this format of command to import ATTACHMENTS to specific images and, if so, please can you advise me of the correct syntax?<o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">If it is not possible to import attachments to specific images, is anyone able to recommend how we can do a batch upload of images AND their attachments, into Omero?<o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><br>Thanks<o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">John</div></div></div></span></blockquote><div><br></div><div><br></div><div><br></div><div><div dir="ltr">PS. feel free to forward that to the list - forgot to hit reply all</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 2, 2013 at 6:18 PM, Graeme Ball <span dir="ltr"><<a href="mailto:graemeball@googlemail.com" target="_blank">graemeball@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div dir="ltr">Hi Will,<div><br></div><div>that was a really big help - I would never have found it without the links. I wasn't even sure it would be possible, but it seems quite simple in the end, e.g.:-</div><div> ...<br><div> img = conn.getObject("Image", oid=51)</div><div> fann = conn.createFileAnnfromLocalFile("./some.log", mimetype="text/plain")<br><div> img.linkAnnotation(fann)</div><div><br></div><div>and the attachment is there :-)</div><div><br></div><div>I didn't really want to write a client/script that would be obsolete as soon as we have OMERO.processing working, but it looks simple enough to be worth doing for the short term.<br></div><div><br></div><div>Thanks again, and I'll be in touch if I run into any further difficulties.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Graeme</div><div><br></div></font></span></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 2, 2013 at 4:31 PM, Will Moore <span dir="ltr"><<a href="mailto:will@lifesci.dundee.ac.uk" target="_blank">will@lifesci.dundee.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; "><div style="word-wrap: break-word; "><div>Hi Graeme,<div><br></div><div> Have a look at some python code we use for auto-populating omero with Projects, Datasets and importing Images.</div><div><a href="https://github.com/ome/omero-setup/blob/master/auto_import.py" target="_blank">https://github.com/ome/omero-setup/blob/master/auto_import.py</a></div><div><br></div><div>This is something we use to set-up a server for testing etc.</div><div><br></div><div>Since you can get the pixels ID from the import process, E.g. see:</div><div><a href="https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/test/integration/library.py#L161" target="_blank">https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/test/integration/library.py#L161</a></div><div>you can get the Image ID (can't assume they're the same as in that example) then add some annotations etc (see link below).</div><div><br></div><div><br></div><div>For writing your own Python client / scripts etc, you should start</div><div><a href="https://www.openmicroscopy.org/site/support/omero4/developers/Python.html" target="_blank">https://www.openmicroscopy.org/site/support/omero4/developers/Python.html</a></div><div><br></div><div>For more detail, try the source code of the "Blitz Gateway" - Python wrappers around the core OMERO api, which</div><div>is the 'conn' etc used in many of the starter examples.</div><div><a href="https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/src/omero/gateway/__init__.py" target="_blank">https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/src/omero/gateway/__init__.py</a></div><div><br></div><div><br></div><div> Hope that helps,</div><div><br></div><div> Let us know if you have any more questions,</div><div><br></div><div> Cheers,</div><div><br></div><div> Will. </div><div><br></div><div><br></div></div><div><br><div><div><div>On 2 May 2013, at 15:54, Graeme Ball wrote:</div><br></div><blockquote type="cite"><div><div><div dir="ltr"><span style="font-family: arial, sans-serif; font-size: 12.727272033691406px; ">Dear OME,</span><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; "><br></div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; ">I have been writing OMERO scripts to process data and re-import the results, but have hit a couple of snags with the imports.</div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; "><br></div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; ">I would like to upload results to the same dataset as the images they are derived from, and the command line importer documentation suggests this is possible using the -d option. </div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; "><a href="http://www.openmicroscopy.org/site/support/omero4/users/command-line-import.html" target="_blank">http://www.openmicroscopy.org/site/support/omero4/users/command-line-import.html</a><br></div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; ">However, if I try for example, "-d 51" I get:-</div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; "> Unknown debug action: set(['51']) <br></div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; ">which seems to agree with the contents of OMERO.server/lib/python/omero/cli.py (if that is the right file)</div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; "><br></div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; ">I would also like to attach results (text files etc.) to each image, but there is no option using the command line importer. The reason I am using the command line importer is that the results are being processed remotely (and we have not managed to set up OMERO.processor as yet). </div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; "><br></div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; ">Should I be attempting to write our own python client? And if so, where would be a good place to start? OMERO.server/lib/python/omero/clients.py perhaps?</div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; "><br></div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; ">Thanks & Best Regards,</div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; "><br></div><div style="font-family: arial, sans-serif; font-size: 12.727272033691406px; ">Graeme</div></div></div></div><div>_______________________________________________<br>ome-users mailing list<br><a href="mailto:ome-users@lists.openmicroscopy.org.uk" target="_blank">ome-users@lists.openmicroscopy.org.uk</a><br><a href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users" target="_blank">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users</a><br></div></blockquote></div><br></div></div></blockquote></div><br></div></div></div></blockquote></div></div></div><div><br></div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div lang="EN-GB" link="#0563C1" vlink="#954F72"><div class="WordSection1" style="page: WordSection1; "><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><b><span style="font-size: 10pt; font-family: Arial, sans-serif; color: rgb(79, 129, 189); ">-------------------------------------------------------------------------------------------------------------------------------------------- </span></b><span style="color: rgb(15, 18, 111); "><o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><b><span style="font-family: Arial, sans-serif; color: rgb(84, 141, 212); ">John Webber<br></span></b><span style="color: rgb(31, 73, 125); ">Computing and Information Services</span><span style="color: rgb(15, 18, 111); "><o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><span style="color: rgb(31, 73, 125); ">NBI Partnership Ltd</span><span style="color: rgb(15, 18, 111); "><o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><span style="color: rgb(31, 73, 125); ">Norwich Research park</span><span style="color: rgb(15, 18, 111); "><o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><span style="color: rgb(31, 73, 125); ">Colney Lane</span><span style="color: rgb(15, 18, 111); "><o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><span style="color: rgb(31, 73, 125); ">Norwich</span><span style="color: rgb(15, 18, 111); "><o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><span style="color: rgb(31, 73, 125); ">NR4 7UH</span><span style="color: rgb(15, 18, 111); "><o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><span style="color: rgb(31, 73, 125); "> </span><span style="color: rgb(15, 18, 111); "><o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><span style="color: rgb(31, 73, 125); ">E-Mail:</span><span><span class="Apple-converted-space"> </span></span><span style="color: rgb(31, 73, 125); "><a href="mailto:john.webber@nbi.ac.uk" style="color: rgb(5, 99, 193); text-decoration: underline; "><span style="color: blue; ">john.webber@nbi.ac.uk</span></a></span><span style="color: rgb(15, 18, 111); "><o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><span style="color: rgb(31, 73, 125); ">Web:</span><span><span class="Apple-converted-space"> </span></span><span style="color: rgb(31, 73, 125); "> <span class="Apple-converted-space"> </span><a href="http://www.nbi.ac.uk/" style="color: rgb(5, 99, 193); text-decoration: underline; "><span style="color: blue; ">http://www.nbi.ac.uk</span></a></span><span style="color: rgb(15, 18, 111); "><o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><span style="color: rgb(31, 73, 125); ">Tel:</span><span><span class="Apple-converted-space"> </span></span><span style="color: rgb(31, 73, 125); "> +44(0)1603 450 818<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><span style="color: rgb(31, 73, 125); "><o:p> </o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><span style="color: rgb(31, 73, 125); ">Helpdesk (Tel): 1234</span><span><span class="Apple-converted-space"> </span></span><span style="color: rgb(31, 73, 125); "> HPC Support (Web):</span><span><span class="Apple-converted-space"> </span></span><span style="color: rgb(31, 73, 125); "> <span class="Apple-converted-space"> </span><a href="http://hpc.nbi.ac.uk/" style="color: rgb(5, 99, 193); text-decoration: underline; "><span style="color: blue; ">http://hpc.nbi.ac.uk</span></a> (NBI internal)<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 12pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><span style="color: rgb(31, 73, 125); "> HPC Support (Tel):</span><span><span class="Apple-converted-space"> </span></span><span style="color: rgb(31, 73, 125); "> 2003 (NBI internal)<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="color: rgb(31, 73, 125); "> </span><span style="color: rgb(15, 18, 111); "><o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><i><span style="color: rgb(31, 73, 125); ">The NBI Partnership Ltd provides non-scientific services to the Institute of Food Research, the John Innes Centre, The Genome Analysis Centre and The Sainsbury Laboratory</span></i><span style="color: rgb(15, 18, 111); "><o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div></div>_______________________________________________<br>ome-users mailing list<br><a href="mailto:ome-users@lists.openmicroscopy.org.uk" style="color: rgb(5, 99, 193); text-decoration: underline; ">ome-users@lists.openmicroscopy.org.uk</a><br><a href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users" style="color: rgb(5, 99, 193); text-decoration: underline; ">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users</a><br></div></span></blockquote></div><br></div></body></html>