Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Open-source bio-image data management. Use the omero-py client to connect to an OMERO server, retrieve images as numpy arrays, annotate with tags and key-value pairs, manage ROIs, and feed image data into Python analysis pipelines — programmatically, no GUI.
.claude/skills/jaechang-hits-omero-integration/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 128% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 98% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 239% | 0% |
| case-09 | ✓→✓ | = Same ✓ | 231% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 167% | 0% |
OMERO is an open-source image data management system widely used in microscopy facilities and core labs. The omero-py library provides a Python client (BlitzGateway) that connects to an OMERO server, allowing programmatic access to images, datasets, projects, tags, annotations, and ROIs. Use it to build automated analysis workflows that pull images from OMERO, process them in Python, and write results back as annotations.
tifffile, aicsimageio, or imageio directly.omero-py, numpy, Pillowomero-py internals), Ice 3.6 (installed automatically via conda)omero-py has complex dependenciesbashconda create -n omero python=3.9 conda activate omero conda install -c ome -c conda-forge omero-py pip install numpy Pillow
pythonimport omero from omero.gateway import BlitzGateway # Connect to OMERO server conn = BlitzGateway("username", "password", host="omero.example.org", port=4064) conn.connect() print(f"Connected: {conn.isConnected()}, user: {conn.getUser().getName()}") # Get an image by ID and download as numpy array image = conn.getObject("Image", 12345) pixels = image.getPrimaryPixels() plane = pixels.getPlane(0, 0, 0) # z=0, c=0, t=0 print(f"Image shape: {plane.shape}, dtype: {plane.dtype}") conn.close()
BlitzGateway is the main entry point for all server interactions.
pythonfrom omero.gateway import BlitzGateway # Establish connection conn = BlitzGateway( username="user", passwd="password", host="omero.example.org", port=4064, secure=True, ) success = conn.connect() print(f"Connected: {success}") print(f"Server version: {conn.getServerVersion()}") print(f"Current group: {conn.getGroupFromContext().getName()}") # Always close when done conn.close()
python# Context manager pattern for automatic cleanup class OmeroConnection: def __init__(self, **kwargs): self.conn = BlitzGateway(**kwargs) def __enter__(self): self.conn.connect() return self.conn def __exit__(self, *args): self.conn.close() with OmeroConnection(username="user", passwd="pass", host="omero.example.org", port=4064) as conn: print(f"Connected as: {conn.getUser().getFullName()}")
Traverse the OMERO data hierarchy (Project → Dataset → Image).
python# List all projects for the current user for project in conn.listProjects(): print(f"Project {project.getId()}: {project.getName()}") for dataset in project.listChildren(): print(f" Dataset {dataset.getId()}: {dataset.getName()}") for image in dataset.listChildren(): print(f" Image {image.getId()}: {image.getName()}")
python# Search for images by name results = conn.searchObjects(["Image"], "GFP_control") for img in results: print(f" Found: {img.getId()} - {img.getName()}") # Get a specific object by ID image = conn.getObject("Image", 12345) dataset = conn.getObject("Dataset", 678) project = conn.getObject("Project", 90) print(f"Image: {image.getName()}, size: {image.getSizeX()}x{image.getSizeY()}") print(f"Channels: {image.getSizeC()}, Z-slices: {image.getSizeZ()}, timepoints: {image.getSizeT()}")
Retrieve pixel data as numpy arrays for processing.
pythonimport numpy as np image = conn.getObject("Image", 12345) pixels = image.getPrimaryPixels() # Get a single 2D plane: getPlane(z_index, channel_index, time_index) plane = pixels.getPlane(0, 0, 0) print(f"Plane shape: {plane.shape}, dtype: {plane.dtype}") # Get all channels at z=0, t=0 planes = [pixels.getPlane(0, c, 0) for c in range(image.getSizeC())] stack = np.stack(planes, axis=0) # shape: (C, Y, X) print(f"Multi-channel stack: {stack.shape}")
python# Efficient bulk download using getTiles (for large images) image = conn.getObject("Image", 12345) pixels = image.getPrimaryPixels() tile_coords = [(0, 0, 0, (0, 0, 512, 512))] # (z, c, t, (x, y, w, h)) for tile in pixels.getTiles(tile_coords): print(f"Tile shape: {tile.shape}") # (512, 512) numpy array
Add, retrieve, and update tags and key-value pair annotations on OMERO objects.
pythonimport omero # Add a tag to an image tag_ann = omero.gateway.TagAnnotationWrapper(conn) tag_ann.setValue("passed_QC") tag_ann.setNs("my.analysis.namespace") tag_ann.save() image = conn.getObject("Image", 12345) image.linkAnnotation(tag_ann) print(f"Tag '{tag_ann.getValue()}' linked to image {image.getId()}")
python# Add key-value pairs (MapAnnotation) to an image map_ann = omero.gateway.MapAnnotationWrapper(conn) map_ann.setNs("openmicroscopy.org/omero/client/mapAnnotation") kv_pairs = [ ["analysis_tool", "CellProfiler 4.2"], ["cell_count", "342"], ["mean_intensity", "1847.3"], ["analysis_date", "2026-02-18"], ] map_ann.setValue(kv_pairs) map_ann.save() image.linkAnnotation(map_ann) print(f"Key-value annotation attached to image {image.getId()}") # Read existing annotations for ann in image.listAnnotations(): print(f" {ann.OMERO_TYPE}: {ann.getValue()}")
Read segmentation ROIs (shapes) stored in OMERO for downstream quantification.
pythonfrom omero.model import RoiI # Get all ROIs for an image roi_service = conn.getRoiService() result = roi_service.findByImage(12345, None) for roi in result.rois: for shape in roi.copyShapes(): shape_type = shape.__class__.__name__ print(f" ROI {roi.id.val}: {shape_type}") if shape_type == "RectangleI": print(f" x={shape.x.val:.1f}, y={shape.y.val:.1f}, " f"w={shape.width.val:.1f}, h={shape.height.val:.1f}") elif shape_type == "EllipseI": print(f" cx={shape.x.val:.1f}, cy={shape.y.val:.1f}, " f"rx={shape.radiusX.val:.1f}, ry={shape.radiusY.val:.1f}")
python# Convert ROI masks to numpy boolean arrays import numpy as np from omero.gateway import BlitzGateway def roi_to_mask(shape, height, width): """Convert a rectangle ROI to a boolean numpy mask.""" mask = np.zeros((height, width), dtype=bool) x = int(shape.x.val) y = int(shape.y.val) w = int(shape.width.val) h = int(shape.height.val) mask[y:y+h, x:x+w] = True return mask image = conn.getObject("Image", 12345) height = image.getSizeY() width = image.getSizeX() result = conn.getRoiService().findByImage(12345, None) for roi in result.rois: for shape in roi.copyShapes(): if shape.__class__.__name__ == "RectangleI": mask = roi_to_mask(shape, height, width) print(f"ROI mask: {mask.sum()} pixels selected")
OMERO organizes data as Project → Dataset → Image. Images contain pixel data plus metadata (channels, Z-slices, timepoints). Annotations (tags, key-value pairs, comments) can be attached to any level of the hierarchy.
python# Hierarchy navigation project = conn.getObject("Project", 90) for dataset in project.listChildren(): imgs = list(dataset.listChildren()) print(f"Dataset '{dataset.getName()}': {len(imgs)} images")
OMERO stores pixels as (Z, C, T) stacks. getPlane(z, c, t) returns a single 2D numpy array. For large images, use getTiles to download spatial subregions. Pixel type (uint8, uint16, float32) matches the original acquisition format.
pythonimage = conn.getObject("Image", 12345) pixels = image.getPrimaryPixels() ptype = pixels.getPixelsType().getValue() print(f"Pixel type: {ptype}") # e.g., "uint16" print(f"Dimensions: XY={image.getSizeX()}x{image.getSizeY()}, " f"Z={image.getSizeZ()}, C={image.getSizeC()}, T={image.getSizeT()}")
Goal: Download all images from a dataset, apply processing, and store results as key-value annotations.
pythonimport numpy as np from omero.gateway import BlitzGateway, MapAnnotationWrapper def mean_intensity(plane): return float(plane.mean()) conn = BlitzGateway("user", "pass", host="omero.example.org", port=4064) conn.connect() dataset = conn.getObject("Dataset", 678) results = [] for image in dataset.listChildren(): pixels = image.getPrimaryPixels() plane = pixels.getPlane(0, 0, 0) # first z, channel 0, t=0 mi = mean_intensity(plane) results.append((image, mi)) # Attach mean intensity as key-value annotation ann = MapAnnotationWrapper(conn) ann.setNs("my.pipeline.v1") ann.setValue([["mean_intensity_ch0", f"{mi:.2f}"]]) ann.save() image.linkAnnotation(ann) print(f"Image {image.getId()} '{image.getName()}': mean={mi:.2f}") print(f"\nProcessed {len(results)} images in dataset '{dataset.getName()}'") conn.close()
Goal: Find all images tagged "screen_hits", download channel 1 as numpy arrays, and save as TIFF files.
pythonimport numpy as np import tifffile from omero.gateway import BlitzGateway conn = BlitzGateway("user", "pass", host="omero.example.org", port=4064) conn.connect() # Find images with a specific tag tag_value = "screen_hits" tagged_images = [] for ann in conn.getObjects("TagAnnotation", attributes={"textValue": tag_value}): for image in ann.listLinkedObjects(["Image"]): tagged_images.append(image) print(f"Found {len(tagged_images)} images tagged '{tag_value}'") for image in tagged_images: pixels = image.getPrimaryPixels() # Download DAPI channel (index 0) at z=0, t=0 plane = pixels.getPlane(0, 0, 0) fname = f"image_{image.getId()}_DAPI.tif" tifffile.imwrite(fname, plane) print(f"Saved {fname}: shape={plane.shape}, dtype={plane.dtype}") conn.close() print("Export complete")
| Parameter | Module | Default | Range / Options | Effect | |-----------|--------|---------|-----------------|--------| | host | BlitzGateway | required | hostname or IP | OMERO server address | | port | BlitzGateway | 4064 | 1024–65535 | OMERO server port (4064 = standard) | | secure | BlitzGateway | False | True, False | Use SSL/TLS encrypted connection | | z, c, t | getPlane | 0, 0, 0 | 0 – size-1 | Z-slice, channel, timepoint indices | | tile_coords | getTiles | — | list of (z,c,t,(x,y,w,h)) | Spatial subregion download coordinates | | Ns | annotations | None | any URI string | Namespace for annotation filtering |
conn.close() after all operations, or use a context manager. Unclosed connections consume server resources and can cause session timeouts.Ns (namespace URI) on every annotation you create so your programmatic annotations can be distinguished from manual ones and other tools.getPlane(z, c, t) with specific indices rather than downloading all planes. For spatial subsets, use getTiles.getSizeX(), getSizeY(), getSizeC(), getSizeZ(), getSizeT() before accessing pixel data to avoid index-out-of-bounds errors on unexpectedly shaped datasets.When to use: Inspect existing annotations before adding new ones to avoid duplicates.
pythonimage = conn.getObject("Image", 12345) for ann in image.listAnnotations(): if ann.OMERO_TYPE == "TagAnnotation": print(f" Tag: '{ann.getValue()}' (ns={ann.getNs()})") elif ann.OMERO_TYPE == "MapAnnotation": for k, v in ann.getValue(): print(f" KV: {k} = {v}")
When to use: Create a maximum intensity projection across all Z-slices for a given channel.
pythonimport numpy as np def max_projection(image, channel=0, timepoint=0): pixels = image.getPrimaryPixels() planes = [pixels.getPlane(z, channel, timepoint) for z in range(image.getSizeZ())] stack = np.stack(planes, axis=0) return stack.max(axis=0) image = conn.getObject("Image", 12345) proj = max_projection(image, channel=1) print(f"Max projection shape: {proj.shape}, max value: {proj.max()}")
getPlane(): shape (Y, X), dtype matching acquisition (uint8, uint16, float32)(C, Y, X) when stacking planesomero.model objects with coordinate attributes| Problem | Cause | Solution | |---------|-------|----------| | Ice.ConnectionRefusedException | Wrong host/port or server down | Verify host and port=4064; confirm server is running | | omero.SecurityViolation | Insufficient permissions on object | Check group membership; ask server admin to grant access | | ImportError: omero | omero-py not installed via conda | Use conda install -c ome -c conda-forge omero-py; pip install is unreliable | | AttributeError: 'NoneType' object | Object ID not found on server | Verify the object exists with conn.getObject(type, id) returns non-None | | Ice.MemoryLimitException | Downloading very large image all at once | Use getTiles() for spatial subsets or getPlane() per slice | | Slow download speed | Downloading many small planes sequentially | Use getTiles() with a list of all coordinates for batch download | | Session timeout mid-run | Long-running analysis exceeds server idle timeout | Call conn.keepAlive() periodically in long loops |
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-09 | pass→pass | 9,583 | 6,560 | -32% | 1 | 1 | 0% | 1,787 | 5,923 | +231% | 0 | 0 | — |
case-01 | fail→pass | 15,265 | 41,611 | +173% | 1 | 1 | 0% | 3,054 | 6,967 | +128% | 0 | 0 | — |
case-02 | pass→pass | 11,217 | 8,679 | -23% | 1 | 1 | 0% | 2,309 | 6,176 | +167% | 0 | 0 | — |
case-03 | pass→pass | 7,020 | 5,274 | -25% | 1 | 1 | 0% | 1,348 | 5,600 | +315% | 0 | 0 | — |
case-04 | pass→pass | 8,111 | 7,844 | -3% | 1 | 1 | 0% | 1,583 | 6,110 | +286% | 0 | 0 | — |
case-10 | pass→pass | 12,400 | 8,016 | -35% | 1 | 1 | 0% | 2,475 | 6,379 | +158% | 0 | 0 | — |
case-05 | fail→pass | 15,453 | 5,331 | -66% | 1 | 1 | 0% | 2,812 | 5,579 | +98% | 0 | 0 | — |
case-06 | pass→pass | 7,443 | 5,239 | -30% | 1 | 1 | 0% | 1,373 | 5,529 | +303% | 0 | 0 | — |
case-07 | fail→fail | 11,858 | 5,878 | -50% | 1 | 1 | 0% | 2,348 | 5,790 | +147% | 0 | 0 | — |
case-08 | pass→pass | 13,089 | 6,078 | -54% | 1 | 1 | 0% | 2,646 | 5,861 | +122% | 0 | 0 | — |
case-11 | pass→pass | 12,889 | 7,853 | -39% | 1 | 1 | 0% | 2,519 | 6,058 | +140% | 0 | 0 | — |
case-12 | pass→pass | 10,048 | 10,067 | +0% | 1 | 1 | 0% | 2,028 | 6,692 | +230% | 0 | 0 | — |
case-13 | pass→pass | 22,627 | 7,201 | -68% | 1 | 1 | 0% | 4,271 | 6,156 | +44% | 0 | 0 | — |
case-14 | fail→fail | 33,430 | 16,317 | -51% | 1 | 1 | 0% | 2,931 | 7,537 | +157% | 0 | 0 | — |
case-15 | pass→pass | 39,789 | 17,002 | -57% | 1 | 1 | 0% | 3,271 | 7,045 | +115% | 0 | 0 | — |
case-16 | pass→pass | 13,941 | 10,377 | -26% | 1 | 1 | 0% | 2,250 | 6,328 | +181% | 0 | 0 | — |
case-17 | pass→pass | 11,403 | 9,899 | -13% | 1 | 1 | 0% | 2,368 | 6,763 | +186% | 0 | 0 | — |
case-18 | fail→pass | 9,011 | 6,885 | -24% | 1 | 1 | 0% | 1,746 | 5,927 | +239% | 0 | 0 | — |
case-19 | pass→pass | 8,377 | 4,731 | -44% | 1 | 1 | 0% | 1,517 | 5,501 | +263% | 0 | 0 | — |
case-20 | pass→pass | 18,569 | 7,093 | -62% | 1 | 1 | 0% | 1,827 | 5,773 | +216% | 0 | 0 | — |
case-21 | pass→pass | 7,175 | 6,191 | -14% | 1 | 1 | 0% | 1,289 | 5,718 | +344% | 0 | 0 | — |
case-22 | pass→pass | 13,038 | 9,347 | -28% | 1 | 1 | 0% | 2,251 | 6,466 | +187% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +14 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.