annotations
БесплатноБез исполняемых скриптовНе проверенCreate, list, filter, update, and delete annotations on NimbusImage datasets using the nimbusimage Python API. Use this skill when the user wants to work with…
от arjunrajlaboratory★ 22 звезды на GitHubОб этом скилле
NimbusImage — Annotations
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.
Listing and filtering
# 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")
Creating annotations
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)
Bulk creation
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},
)
Updating
# 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"]}),
])
Deleting
# Single delete
ds.annotations.delete("annotation_id")
# Bulk delete (single HTTP request)
ds.annotations.delete_many(["id1", "id2", "id3"])
Geometry helpers
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)
Client-side filtering
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]
Common patterns
Extract measurements from 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}")
Convert detection results to annotations
# 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)
Important notes
- Coordinates use the server's convention (x/y may be swapped from numpy row/co
Установить annotations в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл annotations?
Create, list, filter, update, and delete annotations on NimbusImage datasets using the nimbusimage Python API. Use this skill when the user wants to work with annotations — creating points or polygons, filtering by shape or tags, bulk operations, geometry conversion (shapely, numpy masks), or programmatic annotation manipulation. Also use when you see ds.annotations in code, or the user mentions spots, cells, nuclei, ROIs, polygons, or segmentation masks in an imaging context.
Как установить скилл annotations?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл annotations запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic