omero-integration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OMERO Integration

OMERO 集成

Overview

概述

OMERO is an open-source platform for managing, visualizing, and analyzing microscopy images and metadata. Access images via Python API, retrieve datasets, analyze pixels, manage ROIs and annotations, for high-content screening and microscopy workflows.
OMERO是一个用于管理、可视化和分析显微图像及元数据的开源平台。可通过Python API访问图像、检索数据集、分析像素、管理ROI和标注,适用于高内涵筛选和显微工作流。

When to Use This Skill

何时使用此技能

This skill should be used when:
  • Working with OMERO Python API (omero-py) to access microscopy data
  • Retrieving images, datasets, projects, or screening data programmatically
  • Analyzing pixel data and creating derived images
  • Creating or managing ROIs (regions of interest) on microscopy images
  • Adding annotations, tags, or metadata to OMERO objects
  • Storing measurement results in OMERO tables
  • Creating server-side scripts for batch processing
  • Performing high-content screening analysis
在以下场景中应使用此技能:
  • 使用OMERO Python API(omero-py)访问显微数据
  • 以编程方式检索图像、数据集、项目或筛选数据
  • 分析像素数据并创建衍生图像
  • 在显微图像上创建或管理ROI(感兴趣区域)
  • 为OMERO对象添加标注、标签或元数据
  • 将测量结果存储在OMERO表格中
  • 创建用于批量处理的服务器端脚本
  • 执行高内涵筛选分析

Core Capabilities

核心功能

This skill covers eight major capability areas. Each is documented in detail in the references/ directory:
此技能涵盖八大核心功能领域,每个领域的详细文档都在references/目录中:

1. Connection & Session Management

1. 连接与会话管理

File:
references/connection.md
Establish secure connections to OMERO servers, manage sessions, handle authentication, and work with group contexts. Use this for initial setup and connection patterns.
Common scenarios:
  • Connect to OMERO server with credentials
  • Use existing session IDs
  • Switch between group contexts
  • Manage connection lifecycle with context managers
文件
references/connection.md
建立与OMERO服务器的安全连接,管理会话,处理身份验证,并在组上下文下工作。用于初始设置和连接模式配置。
常见场景
  • 使用凭据连接OMERO服务器
  • 使用现有会话ID
  • 在不同组上下文间切换
  • 使用上下文管理器管理连接生命周期

2. Data Access & Retrieval

2. 数据访问与检索

File:
references/data_access.md
Navigate OMERO's hierarchical data structure (Projects → Datasets → Images) and screening data (Screens → Plates → Wells). Retrieve objects, query by attributes, and access metadata.
Common scenarios:
  • List all projects and datasets for a user
  • Retrieve images by ID or dataset
  • Access screening plate data
  • Query objects with filters
文件
references/data_access.md
浏览OMERO的层级数据结构(项目→数据集→图像)和筛选数据(筛选集→培养板→孔)。检索对象、按属性查询并访问元数据。
常见场景
  • 列出用户的所有项目和数据集
  • 通过ID或数据集检索图像
  • 访问筛选培养板数据
  • 使用过滤器查询对象

3. Metadata & Annotations

3. 元数据与标注

File:
references/metadata.md
Create and manage annotations including tags, key-value pairs, file attachments, and comments. Link annotations to images, datasets, or other objects.
Common scenarios:
  • Add tags to images
  • Attach analysis results as files
  • Create custom key-value metadata
  • Query annotations by namespace
文件
references/metadata.md
创建和管理标注,包括标签、键值对、文件附件和注释。将标注关联到图像、数据集或其他对象。
常见场景
  • 为图像添加标签
  • 将分析结果作为文件附加
  • 创建自定义键值元数据
  • 按命名空间查询标注

4. Image Processing & Rendering

4. 图像处理与渲染

File:
references/image_processing.md
Access raw pixel data as NumPy arrays, manipulate rendering settings, create derived images, and manage physical dimensions.
Common scenarios:
  • Extract pixel data for computational analysis
  • Generate thumbnail images
  • Create maximum intensity projections
  • Modify channel rendering settings
文件
references/image_processing.md
以NumPy数组形式访问原始像素数据,操作渲染设置,创建衍生图像,并管理物理尺寸。
常见场景
  • 提取像素数据用于计算分析
  • 生成缩略图
  • 创建最大强度投影
  • 修改通道渲染设置

5. Regions of Interest (ROIs)

5. 感兴趣区域(ROIs)

File:
references/rois.md
Create, retrieve, and analyze ROIs with various shapes (rectangles, ellipses, polygons, masks, points, lines). Extract intensity statistics from ROI regions.
Common scenarios:
  • Draw rectangular ROIs on images
  • Create polygon masks for segmentation
  • Analyze pixel intensities within ROIs
  • Export ROI coordinates
文件
references/rois.md
创建、检索和分析不同形状的ROI(矩形、椭圆、多边形、掩码、点、线)。提取ROI区域内的强度统计数据。
常见场景
  • 在图像上绘制矩形ROI
  • 创建用于分割的多边形掩码
  • 分析ROI内的像素强度
  • 导出ROI坐标

6. OMERO Tables

6. OMERO表格

File:
references/tables.md
Store and query structured tabular data associated with OMERO objects. Useful for analysis results, measurements, and metadata.
Common scenarios:
  • Store quantitative measurements for images
  • Create tables with multiple column types
  • Query table data with conditions
  • Link tables to specific images or datasets
文件
references/tables.md
存储和查询与OMERO对象关联的结构化表格数据,适用于分析结果、测量数据和元数据。
常见场景
  • 存储图像的定量测量结果
  • 创建包含多种列类型的表格
  • 按条件查询表格数据
  • 将表格关联到特定图像或数据集

7. Scripts & Batch Operations

7. 脚本与批量操作

File:
references/scripts.md
Create OMERO.scripts that run server-side for batch processing, automated workflows, and integration with OMERO clients.
Common scenarios:
  • Process multiple images in batch
  • Create automated analysis pipelines
  • Generate summary statistics across datasets
  • Export data in custom formats
文件
references/scripts.md
创建在服务器端运行的OMERO.scripts,用于批量处理、自动化工作流以及与OMERO客户端集成。
常见场景
  • 批量处理多张图像
  • 创建自动化分析流水线
  • 生成跨数据集的汇总统计数据
  • 以自定义格式导出数据

8. Advanced Features

8. 高级功能

File:
references/advanced.md
Covers permissions, filesets, cross-group queries, delete operations, and other advanced functionality.
Common scenarios:
  • Handle group permissions
  • Access original imported files
  • Perform cross-group queries
  • Delete objects with callbacks
文件
references/advanced.md
涵盖权限管理、文件集、跨组查询、删除操作及其他高级功能。
常见场景
  • 处理组权限
  • 访问原始导入文件
  • 执行跨组查询
  • 通过回调删除对象

Installation

安装

bash
uv pip install omero-py
Requirements:
  • Python 3.7+
  • Zeroc Ice 3.6+
  • Access to an OMERO server (host, port, credentials)
bash
uv pip install omero-py
要求
  • Python 3.7+
  • Zeroc Ice 3.6+
  • 可访问OMERO服务器(主机、端口、凭据)

Quick Start

快速开始

Basic connection pattern:
python
from omero.gateway import BlitzGateway
基础连接模式:
python
from omero.gateway import BlitzGateway

Connect to OMERO server

Connect to OMERO server

conn = BlitzGateway(username, password, host=host, port=port) connected = conn.connect()
if connected: # Perform operations for project in conn.listProjects(): print(project.getName())
# Always close connection
conn.close()
else: print("Connection failed")

**Recommended pattern with context manager:**

```python
from omero.gateway import BlitzGateway

with BlitzGateway(username, password, host=host, port=port) as conn:
    # Connection automatically managed
    for project in conn.listProjects():
        print(project.getName())
    # Automatically closed on exit
conn = BlitzGateway(username, password, host=host, port=port) connected = conn.connect()
if connected: # Perform operations for project in conn.listProjects(): print(project.getName())
# Always close connection
conn.close()
else: print("Connection failed")

**推荐的上下文管理器模式**:

```python
from omero.gateway import BlitzGateway

with BlitzGateway(username, password, host=host, port=port) as conn:
    # Connection automatically managed
    for project in conn.listProjects():
        print(project.getName())
    # Automatically closed on exit

Selecting the Right Capability

选择合适的功能

For data exploration:
  • Start with
    references/connection.md
    to establish connection
  • Use
    references/data_access.md
    to navigate hierarchy
  • Check
    references/metadata.md
    for annotation details
For image analysis:
  • Use
    references/image_processing.md
    for pixel data access
  • Use
    references/rois.md
    for region-based analysis
  • Use
    references/tables.md
    to store results
For automation:
  • Use
    references/scripts.md
    for server-side processing
  • Use
    references/data_access.md
    for batch data retrieval
For advanced operations:
  • Use
    references/advanced.md
    for permissions and deletion
  • Check
    references/connection.md
    for cross-group queries
用于数据探索
  • references/connection.md
    开始建立连接
  • 使用
    references/data_access.md
    浏览层级结构
  • 查看
    references/metadata.md
    了解标注详情
用于图像分析
  • 使用
    references/image_processing.md
    访问像素数据
  • 使用
    references/rois.md
    进行基于区域的分析
  • 使用
    references/tables.md
    存储结果
用于自动化
  • 使用
    references/scripts.md
    进行服务器端处理
  • 使用
    references/data_access.md
    进行批量数据检索
用于高级操作
  • 使用
    references/advanced.md
    处理权限和删除操作
  • 查看
    references/connection.md
    了解跨组查询

Common Workflows

常见工作流

Workflow 1: Retrieve and Analyze Images

工作流1:检索并分析图像

  1. Connect to OMERO server (
    references/connection.md
    )
  2. Navigate to dataset (
    references/data_access.md
    )
  3. Retrieve images from dataset (
    references/data_access.md
    )
  4. Access pixel data as NumPy array (
    references/image_processing.md
    )
  5. Perform analysis
  6. Store results as table or file annotation (
    references/tables.md
    or
    references/metadata.md
    )
  1. 连接到OMERO服务器(
    references/connection.md
  2. 导航到数据集(
    references/data_access.md
  3. 从数据集检索图像(
    references/data_access.md
  4. 以NumPy数组形式访问像素数据(
    references/image_processing.md
  5. 执行分析
  6. 将结果存储为表格或文件标注(
    references/tables.md
    references/metadata.md

Workflow 2: Batch ROI Analysis

工作流2:批量ROI分析

  1. Connect to OMERO server
  2. Retrieve images with existing ROIs (
    references/rois.md
    )
  3. For each image, get ROI shapes
  4. Extract pixel intensities within ROIs (
    references/rois.md
    )
  5. Store measurements in OMERO table (
    references/tables.md
    )
  1. 连接到OMERO服务器
  2. 检索带有现有ROI的图像(
    references/rois.md
  3. 针对每张图像,获取ROI形状
  4. 提取ROI内的像素强度(
    references/rois.md
  5. 将测量结果存储在OMERO表格中(
    references/tables.md

Workflow 3: Create Analysis Script

工作流3:创建分析脚本

  1. Design analysis workflow
  2. Use OMERO.scripts framework (
    references/scripts.md
    )
  3. Access data through script parameters
  4. Process images in batch
  5. Generate outputs (new images, tables, files)
  1. 设计分析工作流
  2. 使用OMERO.scripts框架(
    references/scripts.md
  3. 通过脚本参数访问数据
  4. 批量处理图像
  5. 生成输出(新图像、表格、文件)

Error Handling

错误处理

Always wrap OMERO operations in try-except blocks and ensure connections are properly closed:
python
from omero.gateway import BlitzGateway
import traceback

try:
    conn = BlitzGateway(username, password, host=host, port=port)
    if not conn.connect():
        raise Exception("Connection failed")

    # Perform operations

except Exception as e:
    print(f"Error: {e}")
    traceback.print_exc()
finally:
    if conn:
        conn.close()
始终将OMERO操作包裹在try-except块中,并确保连接被正确关闭:
python
from omero.gateway import BlitzGateway
import traceback

try:
    conn = BlitzGateway(username, password, host=host, port=port)
    if not conn.connect():
        raise Exception("Connection failed")

    # Perform operations

except Exception as e:
    print(f"Error: {e}")
    traceback.print_exc()
finally:
    if conn:
        conn.close()

Additional Resources

额外资源

Notes

注意事项

  • OMERO uses group-based permissions (READ-ONLY, READ-ANNOTATE, READ-WRITE)
  • Images in OMERO are organized hierarchically: Project > Dataset > Image
  • Screening data uses: Screen > Plate > Well > WellSample > Image
  • Always close connections to free server resources
  • Use context managers for automatic resource management
  • Pixel data is returned as NumPy arrays for analysis
  • OMERO使用基于组的权限(只读、可读可标注、可读可写)
  • OMERO中的图像按层级组织:项目 > 数据集 > 图像
  • 筛选数据的层级为:筛选集 > 培养板 > 孔 > 孔样本 > 图像
  • 始终关闭连接以释放服务器资源
  • 使用上下文管理器实现自动资源管理
  • 像素数据以NumPy数组形式返回,便于分析