Skip to content

Conversation

@davelopez
Copy link
Contributor

This PR introduces a new file source plugin that enables Galaxy users to browse and import microscopy images from OMERO servers.

Features

  • Hierarchical browsing: Navigate OMERO's Project → Dataset → Image structure
  • Server-side pagination: Efficient browsing of large collections using HQL queries
  • Server-side search: Filter projects, datasets, and images by name on the server
  • Smart image download:
    • Attempts to download original imported files first (preserves original format with some limitations)
    • Falls back to multi-page TIFF export with all Z-planes when originals unavailable
    • Gracefully handles restricted repositories (e.g., IDR) that block original file access

Warning

Multi-file formats are currently not supported. Microscopy formats that consist of multiple files (e.g., some proprietary formats) cannot be downloaded in their original form. In most cases, images will be converted and downloaded as generated multi-page TIFF files containing all Z-planes when possible.

Configuration

Requires OMERO credentials (username, password, host, port) configured via file source templates.

Dependencies

  • omero-py - OMERO Python client
  • Pillow - For TIFF export fallback

How to test the changes?

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    • Install the omero-py dependency following the instructions in https://omero.readthedocs.io/en/stable/developers/Python.html#omero-python-language-bindings

    • Add the new file source template to your config/file_source_templates.yml file:

      - include: ./lib/galaxy/files/templates/examples/omero_server.yml
      
    • Start the Galaxy server and create a new OMERO file source in your user preferences -> Manage Your Repositories
      image

    • Use the IDR connection settings or the ones from your own OMERO instance.
      image

    • Browse your newly added integration from the Upload dialog using "Choose from repository" and selecting your integration.

OmeroFileSource.mp4

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

Introduces support for browsing and downloading OMERO projects, datasets, and images
through a hierarchical interface.
Important: requires manual installation of additional dependencies. Instructions here: https://omero.readthedocs.io/en/stable/developers/Python.html#omero-python-language-bindings
Switches TIFF export to include every Z-plane as separate pages, preserving the full Z-stack for downstream 3D visualization or analysis.
Limits export to the first channel and timepoint to maintain manageable file size.
Improves scalability and performance when browsing OMERO files by introducing paginated queries and efficient entry counting for projects, datasets, and images.

Supports UI pagination and reduces memory usage for large collections by avoiding loading all objects at once.
Enables efficient search and filtering of projects, datasets, and images using HQL queries, improving scalability and user experience when browsing
large OMERO repositories. Updates pagination and counting methods to support
query-based operations.
Catches SecurityViolation when original file download is restricted, allowing graceful fallback to pixel data export for servers like IDR.
Exports the first channel (C=0) and first timepoint (T=0) across all Z-planes.
This preserves the full Z-stack for 3D analysis while keeping the export manageable.
"""
from PIL import Image as PILImage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IOW can you move the import to the top @davelopez ?

@@ -0,0 +1,569 @@
from contextlib import contextmanager
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was uneasy about the size & complexity of this file and asked Claude if it would make sense to break out an interaction layer here - their response was a fairly definitive no (https://gist.github.com/jmchilton/83abdb13c12ce0b103eb307c9e941b7d).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants