<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">Hi,</div>
<div class=""><br class="">
</div>
<div class=""> This could be quite a bit of work, so you will need to start small and build-up functionality as you go. Some investigation will be required - Some things will depend on the type of images you’ll be transferring. You’ll also need to have both
 OMERO servers using the same major version. E.g. 5.3.x.</div>
<div class=""><br class="">
</div>
<div class="">You’ll really need to re-import the images to the central server instead of manually creating new DB entries for all image metadata etc. This can be acheived from the command line, with your OMERO.script invoking “bin/omero import …” to the central
 server.</div>
<div class=""><br class="">
</div>
<div class="">Are these images imported in OMERO 5.0 or later (original files will be in managed repo)?</div>
<div class="">Your script, running on the source OMERO server *may* be able to access the managed repository directly, and call e.g. “bin/omero import /OMERO/ManagedRepository/will_3/2017-10/05/15-31-34.090/control.lsm”</div>
<div class="">This is certainly the easiest solution.</div>
<div class=""><br class="">
</div>
<div class="">Alternatively, if the managed repo is not available then you can download the original images to the folder where the OMERO.script is running and import the images from there.</div>
<div class="">In the simplest case, a single OMERO Image has a single image file. However, some Images are stored as multiple original files in the managed repo, which means they will all need to be downloaded to the script before they can be imported if you
 go for that option.</div>
<div class=""><br class="">
</div>
<div class="">In some cases, a single original file (or set of original files) will generate multiple OMERO Images when imported. So you may find that multiple images in your source server come from the same original file(s). In that case, you will have to
 be careful when you iterate through these images that you don’t import the same original file multiple times.</div>
<div class=""><br class="">
</div>
<div class="">It’s not really possible for OMERO.scripts to be “interactive”. The easiest option for choosing a target is to have your users log in to the webclient (or Insight) in the central server and pick a Project or Dataset ID to enter into the script
 dialog in the other server.</div>
<div class=""><br class="">
</div>
<div class="">Traversing the graph of linked objects Dataset -> Image and handling of file Annotations / duplicate tags etc should be pretty straight-forward once you have the re-import of images working.</div>
<div class=""><br class="">
</div>
<div class="">Please put your script in github and commit all changes as you go. This will allow us to see what you have working and to help or contribute much easier. One option if you don’t already have a repo is to fork
<a href="https://github.com/ome/omero-user-scripts" class="">https://github.com/ome/omero-user-scripts</a> which allows us and the community to find your repo from there.</div>
<div class=""><br class="">
</div>
<div class="">Be careful when handling usernames and passwords in your OMERO.script. Make sure you’re not logging these etc.</div>
<div class=""><br class="">
</div>
<div class="">Initial goals:</div>
<div class=""> - Create an script that can take an Image ID as input, along with username & password of central server. Can use
<a href="https://github.com/openmicroscopy/openmicroscopy/blob/develop/examples/Training/python/Scripting_Service_Example.py" class="">
https://github.com/openmicroscopy/openmicroscopy/blob/develop/examples/Training/python/Scripting_Service_Example.py</a>  </div>
<div class=""> - List original files from source Image</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>for f in image.getImportedImageFiles():</div>
<div class="">    <span class="Apple-tab-span" style="white-space:pre"></span>print f.path, f.name</div>
<div class="">- Create a BlitzGateway connection to central server</div>
<div class="">- You can get a “client” object using  client = conn.c</div>
<div class="">- Command line import using code similar to that in our python test framework (using ‘client’ from above as in the example) :<a href="https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/src/omero/testlib/__init__.py#L277" class="">https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/src/omero/testlib/__init__.py#L277</a> </div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Let us know how this goes,</div>
<div class=""><br class="">
</div>
<div class="">  Regards,</div>
<div class=""><br class="">
</div>
<div class="">  Will.</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div>
<blockquote type="cite" class="">
<div class="">On 12 Oct 2017, at 12:46, Eilidh Troup <<a href="mailto:e.troup@epcc.ed.ac.uk" class="">e.troup@epcc.ed.ac.uk</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">Hi,<br class="">
<br class="">
I’m a software engineer working on data management in biology. Our use case is that lab groups have their own instances of OMERO, and there is also a centrally-hosted university OMERO server which they would like to transfer data to. I’m planning to write a
 script to allow users to transfer data from one OMERO to another. I wanted to run the plans by this forum to see what you thought of the idea, and whether my planned implementation seems sensible.<br class="">
<br class="">
I plan to write a script (OMERO.scripts) to run on the local instances of OMERO and be used through OMERO.server or OMERO.web. This will let the user choose the image, dataset or project that they want to move, and enter their credentials for the central OMERO
 server. Then the script will use the Blitz Gateway to read data from the local server, and then to write to the remote server.
<br class="">
<br class="">
issues: <br class="">
<br class="">
- How will users choose where to put data? It will have to be either in a default project on the central server, or the script would have to be interactive, where the user enters their credentials, and then the central server is contacted so that a list of
 projects and datasets belonging to that user can be presented.<br class="">
<br class="">
- There will be a graph of objects linked to any given one, for example, a dataset with images, tags and attachments. Need to traverse this to transfer all associated data.<br class="">
<br class="">
- Some IDs will need to be mapped from one OMERO to the other, for example tags - shouldn’t create a new one, but link to existing tag with same name on the other OMERO.<br class="">
<br class="">
I’m planning to write the code in Python and use OMERO.scripts and the Blitz Gateway. Please let me know what you think.<br class="">
-- <br class="">
The University of Edinburgh is a charitable body, registered in<br class="">
Scotland, with registration number SC005336.<br class="">
<br class="">
_______________________________________________<br class="">
ome-devel mailing list<br class="">
<a href="mailto:ome-devel@lists.openmicroscopy.org.uk" class="">ome-devel@lists.openmicroscopy.org.uk</a><br class="">
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel<br class="">
</div>
</blockquote>
</div>
<br class="">
<br>
<span style="font-size:10pt;">The University of Dundee is a registered Scottish Charity, No: SC015096</span>
</body>
</html>