Path to Images In OMERO

Hello everyone,

I have a Python script which needed to be uploaded into OMERO. I need to stitch images of a specific folder which have been already uploaded into OMERO server. How can I provide a Path for my Images in Python Script Code, that can be understandable for OMERO and be able to run it?

It would be greatly appreciated if you help me in this case.


Hi @Pegah,

Something like the following:

   # Setup
   image_id = SOMETHING_HERE
   client = MUST_BE_DEFINED

   import os
   from omero.rtypes import unwrap
   resources = client.sf.sharedResources()
   repos = resources.repositories()
   for desc in repos.descriptions:
       if == "ManagedRepository":
           managed_repo_dir = desc.path.val +

   params = omero.sys.ParametersI()
   rows = client.sf.getQueryService().projection("""
       SELECT DISTINCT, ofile.path
           || FROM Image AS i
       JOIN i.fileset AS f
       JOIN f.usedFiles AS fe
       JOIN fe.originalFile AS ofile
       WHERE = :id""", params, {"": "-1"})
   imported_file = os.path.join(managed_repo_dir, unwrap(rows[0][1]))

should give you the path to the first imported file for an image.

:warning: Heads up for anyone using this code: Since only a user who should have permissions to access the image should be allowed to run this code, it is safe as written. Be careful though to not introduce a backdoor into your /OMERO/ManagedRepository!