/nimbus-skills:annotationsfrom nimbus-skills
Create, list, filter, update, and delete annotations on NimbusImage datasets using the nimbusimage Python API. Handles points, polygons, tags, bulk operations, and geometry conversion with shapely/numpy masks.
Ships in nimbus-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Annotations are spatial markers on image datasets — points, polygons, and lines with tags, channel assignment, and location (XY/Z/Time).
Access via ds.annotations on a Dataset object.
# All annotations
all_anns = ds.annotations.list()
# Filter by shape
polygons = ds.annotations.list(shape="polygon")
points = ds.annotations.list(shape="point")
# Filter by tags
nuclei = ds.annotations.list(shape="polygon", tags=["nucleus"])
# Count without fetching
n = ds.annotations.count(shape="polygon", tags=["nucleus"])
# Composition and property statistics without fetching (one aggregation)
s = ds.annotations.summary()
s.total, s.tags, s.shapes # {"cell": 465534, ...}, {"polygon": ...}
s.channels # {0: 34154, 3: 9246, ...} (channel index → count)
s = ds.annotations.summary(tags=["cell"], property_paths=[[prop.id, "Area"]])
s.properties[0].mean # count/mean/std/min/max per path
# Stable pagination for large or changing result sets
for ann in ds.annotations.iter_all(
shape="polygon",
tags=["nucleus"],
page_size=1000,
):
process(ann)
# Get one by ID
ann = ds.annotations.get("annotation_id_here")
import nimbusimage as ni
# Create a point annotation
ann = ni.Annotation.from_point(
x=100.5, y=200.5,
channel=0,
tags=["spot"],
dataset_id=ds.id,
location=ni.Location(xy=0, z=0, time=0),
)
created = ds.annotations.create(ann)
# Create a polygon annotation manually
ann = ni.Annotation(
shape="polygon",
tags=["cell"],
channel=0,
coordinates=[
{"x": 100, "y": 200},
{"x": 150, "y": 200},
{"x": 150, "y": 250},
{"x": 100, "y": 250},
],
dataset_id=ds.id,
location=ni.Location(xy=0, z=0, time=0),
)
created = ds.annotations.create(ann)
Always prefer bulk operations over loops — this is critical for performance.
# Create many at once (single HTTP request)
annotations = [
ni.Annotation.from_point(x=x, y=y, channel=0, tags=["spot"], dataset_id=ds.id)
for x, y in zip(xs, ys)
]
ds.annotations.create_many(annotations)
# With auto-connection to nearest neighbors
ds.annotations.create_many(
annotations,
connect_to={"tags": ["nucleus"], "channel": 0},
)
# Update one annotation
ds.annotations.update("ann_id", {"tags": ["nucleus", "verified"]})
# Bulk update (single HTTP request, no return value)
ds.annotations.update_many([
(ann_id1, {"color": "rgb(255,0,0)"}),
(ann_id2, {"tags": ["nucleus", "verified"]}),
])
# Single delete
ds.annotations.delete("annotation_id")
# Bulk delete (single HTTP request)
ds.annotations.delete_many(["id1", "id2", "id3"])
Annotations have geometry methods for converting between NimbusImage coordinates and shapely/numpy:
ann = ds.annotations.list(shape="polygon")[0]
# Convert to shapely objects
polygon = ann.polygon() # shapely Polygon
point = ann.point() # shapely Point (or centroid for polygons)
cx, cy = ann.centroid() # (x, y) tuple
# Convert to numpy mask
mask = ann.get_mask(ds.shape) # boolean array (H, W)
rows, cols = ann.get_pixels(ds.shape) # pixel index arrays
# Create annotation from shapely polygon
from shapely.geometry import Polygon
poly = Polygon([(100, 200), (150, 200), (150, 250), (100, 250)])
ann = ni.Annotation.from_polygon(poly, channel=0, tags=["cell"], dataset_id=ds.id)
# Create annotation from binary mask
ann = ni.Annotation.from_mask(mask_array, channel=0, tags=["region"], dataset_id=ds.id)
The nimbusimage package includes filter utilities for working with annotation lists in Python:
from nimbusimage import filter_by_tags, filter_by_location, group_by_location
# Filter by tags (client-side, after fetching)
tagged = filter_by_tags(annotations, tags=["nucleus"])
# Filter by location
at_z3 = filter_by_location(annotations, z=3)
# Group by location
grouped = group_by_location(annotations) # dict of (xy, z, time) -> [annotations]
import numpy as np
for ann in ds.annotations.list(shape="polygon"):
img = ds.images.get(channel=0, z=ann.location.z, time=ann.location.time)
mask = ann.get_mask(ds.shape)
intensity = img[mask].mean()
area = mask.sum()
print(f"Annotation {ann.id}: mean={intensity:.1f}, area={area}")
# From a list of (x, y) detections
detections = [(150.5, 200.3), (300.1, 450.7), ...]
annotations = [
ni.Annotation.from_point(x=x, y=y, channel=0, tags=["detected"], dataset_id=ds.id)
for x, y in detections
]
ds.annotations.create_many(annotations)
dataset_id is required when creating annotations — it's the folder ID of the dataset.location defaults to Location(xy=0, z=0, time=0) if not specified.iter_all() for mutation-safe pagination. Offset pagination can skip or repeat records if annotations change between requests.create_many / delete_many for bulk operations — never loop with individual calls.For complete AnnotationAccessor signatures, read references/api-overview.md. For coordinate and bulk-operation caveats, read references/gotchas.md.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub arjunrajlaboratory/nimbusimage --plugin nimbusimage7 skills in this plugin
/analyzeCompute properties, export data, manage connections, and share NimbusImage datasets using the nimbusimage Python API. Use this skill when the user wants to compute annotation measurements, export data as JSON or CSV, create connections between annotations, share datasets with collaborators, or manage access control. Also use when you see ds.properties, ds.export, ds.connections, or ds.sharing in code, or the user mentions measurements, statistics, data export, lineage tracking, or sharing imaging datasets.
/imagesFetch image data from NimbusImage datasets as numpy arrays using the nimbusimage Python API. Use this skill when the user wants to retrieve image frames, composites, z-stacks, crops, or channel data from a NimbusImage dataset. Also use when you see ds.images in code, or the user mentions getting pixel data, viewing channels, making composites, or processing image arrays from their imaging server.
/nimbusimageConnect to a NimbusImage server and work with scientific imaging datasets using the nimbusimage Python API. Use this skill whenever the user mentions NimbusImage, wants to connect to a Girder-based imaging server, list or open datasets, or asks about the nimbusimage package. Also use when you see `import nimbusimage` in code or the user references dataset IDs, channels, z-slices, or time points in an imaging context. This is the entry point — it routes to more specific skills (annotations, images, workers, analyze) for deeper operations. If NimbusImage MCP tools (ni_*) are also connected, prefer this API for anything beyond a quick lookup.
/sg-ingestLoad a Spatial Genomics (GenePS / sganalysis) data export into NimbusImage, one dataset per ROI: DAPI + GFP images, cell polygons, Leiden clusters as tags and a numeric property, UMAP, cell area, the full cell x gene matrix as a spatial table, and the transcript list as a Transcripts overlay. Use when the user mentions Spatial Genomics, GenePS, sganalysis, a DataExport_* zip, basic_results/roi_N, CellxGene.csv, TranscriptList.csv, Boundaries.geojson, or sganalysis.session. Complements xenium-ingest (same server machinery, different inputs).
/workersRun Docker-based computational workers on NimbusImage datasets using the nimbusimage Python API. Use this skill when the user wants to run segmentation, spot detection, property computation, or any Docker worker on their imaging data. Also use when you see ds.annotations.compute or ds.properties.compute in code, or the user mentions running workers, submitting jobs, tracking job status, or automating image analysis pipelines on a NimbusImage server.
/xenium-ingestLoad a 10x Xenium spatial-transcriptomics bundle into NimbusImage: the morphology and H&E images, cell segmentation polygons, a gene-expression marker panel, clustering, a computed UMAP, and cell types as tags. Use this skill when the user mentions Xenium, 10x spatial data, cells.zarr, cell_feature_matrix, transcripts, he_imagealignment, or wants Xenium / spatial-omics cells and per-cell data in NimbusImage. Covers bundle anatomy, micron-to-pixel transforms, H&E alignment, orientation validation, bulk upload, nested property values, and every trap hit on a 709k-cell dataset.
Other plugins' skills for the same job