Omero Integration

Omero Integration

Omero Integration automation and integration for biological image data management

Category: productivity Source: K-Dense-AI/claude-scientific-skills

OMERO Integration is a community skill for connecting with the OMERO bio-image management platform, covering image upload, metadata annotation, dataset organization, image retrieval, and analysis pipeline integration for microscopy data management.

What Is This?

Overview

OMERO Integration provides tools for interacting with OMERO servers that manage biological microscopy image data. It covers image upload that transfers microscopy files with associated metadata to OMERO repositories, metadata annotation that attaches structured key-value pairs, tags, and descriptions to images and datasets, dataset organization that groups related images into projects and datasets with hierarchical structure, image retrieval that fetches stored images with rendering settings for visualization and analysis, and analysis pipeline integration that connects OMERO data with image processing workflows. The skill enables researchers to manage microscopy data through automated workflows.

Who Should Use This

This skill serves microscopy facility staff managing image repositories, bioimaging researchers automating data workflows, and core facilities building analysis pipelines connected to OMERO servers.

Why Use It?

Problems It Solves

Manual image upload and annotation on OMERO servers is slow when processing large microscopy datasets. Image metadata from acquisition systems needs programmatic extraction and attachment to OMERO entries. Analysis scripts that process images locally lack connection to the centralized OMERO repository for results storage. Organizing thousands of images into structured projects requires automated classification.

Core Highlights

Image uploader transfers microscopy files with metadata to OMERO repositories. Annotation manager attaches structured metadata to images and datasets. Dataset organizer creates and manages project hierarchies programmatically. Data connector retrieves images and metadata for external analysis pipelines.

How to Use It?

Basic Usage

from omero.gateway import (
  BlitzGateway)

class OMEROClient:
  def __init__(
    self,
    host: str,
    user: str,
    password: str
  ):
    self.conn = (
      BlitzGateway(
        user, password,
        host=host,
        port=4064))
    self.conn.connect()

  def list_projects(
    self
  ) -> list[dict]:
    projects = []
    for p in self.conn\
        .listProjects():
      projects.append({
        'id': p.getId(),
        'name':
          p.getName(),
        'datasets': [
          {'id':
            d.getId(),
           'name':
            d.getName()}
          for d in p
            .listChildren()
        ]})
    return projects

  def get_image(
    self,
    image_id: int
  ):
    img = self.conn\
      .getObject(
        'Image',
        image_id)
    return {
      'name':
        img.getName(),
      'size': (
        img.getSizeX(),
        img.getSizeY()),
      'channels':
        img.getSizeC()}

  def close(self):
    self.conn.close()

Real-World Examples

from omero.gateway import (
  BlitzGateway)
from omero.model import (
  MapAnnotationI)
from omero.rtypes import (
  rstring)

class BatchAnnotator:
  def __init__(
    self, conn
  ):
    self.conn = conn

  def annotate_images(
    self,
    dataset_id: int,
    annotations:
      dict[str, str]
  ) -> int:
    ds = self.conn\
      .getObject(
        'Dataset',
        dataset_id)
    count = 0
    for img in ds\
        .listChildren():
      ann = (
        MapAnnotationI())
      ann.setNs(
        rstring(
          'custom.ns'))
      kv = [[
        rstring(k),
        rstring(v)]
        for k, v in
          annotations
            .items()]
      ann.setValue(kv)
      ann = self.conn\
        .getUpdateService()\
        .saveAndReturn\
          Object(ann)
      img.linkAnnotation(
        ann)
      count += 1
    return count

Advanced Tips

Use the OMERO tables API to store quantitative analysis results directly alongside images for integrated data exploration. Implement connection pooling when running batch operations to avoid repeated authentication overhead. Leverage OMERO rendering settings to export consistent image representations across different analysis tools.

When to Use It?

Use Cases

Upload a batch of microscopy images with experiment metadata to an OMERO server after acquisition. Annotate all images in a dataset with analysis results from an external processing pipeline. Retrieve images from OMERO with specific annotations for training a machine learning classifier.

Related Topics

OMERO, bioimaging, microscopy data management, image annotation, metadata, image analysis pipelines, and bioimage informatics.

Important Notes

Requirements

OMERO server instance with user account credentials for API access. omero-py Python client library for gateway connections. Network access to the OMERO server from the processing environment.

Usage Recommendations

Do: close gateway connections after batch operations to release server resources. Use structured namespaces for annotations to organize metadata from different analysis workflows. Test upload and annotation scripts on small datasets before running batch operations.

Don't: leave open connections to OMERO servers running indefinitely since this consumes server session resources. Store large derived datasets in OMERO annotations when file attachments or tables are more appropriate. Modify shared project structures without coordinating with other users.

Limitations

OMERO gateway performance depends on network bandwidth between client and server especially for large image transfers. The Python client API requires specific Ice middleware dependencies that can be difficult to install. Concurrent write operations from multiple clients need careful coordination to avoid metadata conflicts.