Skip to main content

Python API for NimbusImage

Project description

nimbusimage

Python API for NimbusImage (app) — programmatic access to scientific imaging datasets, annotations, workers, and analysis.

Installation

pip install nimbusimage

For Docker worker development (includes large_image for writing TIFF files):

pip install nimbusimage[worker]

Authentication

The recommended setup uses a Girder API key, which is persistent and doesn't expire.

How to get an API key:

  • nimbusimage.com (hosted): Email support@cytopixel.com with your account email address to request an API key.
  • Local/self-hosted server: In the Girder admin UI, go to Users > select the user > Edit User > API Keys > create a new key and copy the key string.

Required scopes. The simplest option is a full-access key (leave the scope list empty), which works for everything including polling job status. If you instead create a scoped key, it must include core.user_auth — without it, job.wait() / job.refresh() fail with a confusing 401 Unauthorized even though you own the job. Add jobs.rest.list_job as well so job logs can be read. Recommended scoped-key set: core.data.read, core.data.write, core.data.own, core.user_info.read, core.user_auth, jobs.rest.list_job.

Set environment variables for persistent access:

# Add to ~/.zshrc or ~/.bashrc

# For nimbusimage.com:
export NI_API_URL="https://app.nimbusimage.com/girder/api/v1"
export NI_API_KEY="your-api-key-here"

# For a local server:
export NI_API_URL="http://localhost:8080/api/v1"
export NI_API_KEY="your-api-key-here"

Then connect with no arguments:

import nimbusimage as ni

client = ni.connect()

Or pass credentials explicitly:

client = ni.connect("http://localhost:8080/api/v1", api_key="your-api-key")

Quick start

import nimbusimage as ni

client = ni.connect()

# List datasets
for d in client.list_datasets():
    print(f"{d['name']} (ID: {d['_id']})")

# Open a dataset
ds = client.dataset(name="My Experiment")
print(f"{ds.name}: {ds.channels}, {ds.num_z} z-slices, {ds.shape}")

# Fetch an image
img = ds.images.get(channel=0, z=0)  # numpy array

# Get a composite RGB image
rgb = ds.images.get_composite(dtype="uint8")

# List annotations
polygons = ds.annotations.list(shape="polygon")

# Run a worker
job = ds.annotations.compute(
    image="annotations/random_squares:latest",
    channel=0, tags=["detected"],
    worker_interface={"Number of squares": 10, "Square size": 15},
)
job.wait()

# Export data
ds.export.to_csv(property_paths=[["prop_id", "Area"]], path="results.csv")

# Open in browser
ds.open(z=3)

API overview

The package follows an accessor pattern:

ni.connect() -> NimbusClient
    client.dataset(id) -> Dataset
        ds.images        # fetch frames, composites, z-stacks
        ds.annotations   # create, list, filter, delete annotations
        ds.connections   # parent-child annotation links
        ds.properties    # computed measurements
        ds.collections   # display configuration (layers, tools)
        ds.export        # JSON and CSV export
        ds.history       # undo/redo
        ds.sharing       # access control
    client.list_datasets()
    client.list_workers()
    client.list_projects()

See docs.nimbusimage.com for general documentation and the API reference for detailed API docs.

Claude Code integration

NimbusImage includes skills for Claude Code that teach Claude how to use this API. After installing, you can ask Claude things like "connect to my NimbusImage server and list datasets" and it will write correct code.

Install the skills

Option A — Marketplace install (recommended):

# Add the NimbusImage marketplace (one-time)
claude plugin marketplace add arjunrajlaboratory/NimbusImage

# Install the nimbusimage plugin
claude plugin install nimbusimage@arjunrajlaboratory/NimbusImage

Option B — For this session only:

claude --plugin-dir /path/to/NimbusImage/plugins/nimbusimage

Option C — Permanent (project-scoped):

Add to your project's .claude/settings.local.json:

{
  "plugins": ["/path/to/NimbusImage/plugins/nimbusimage"]
}

Available skills

Command What it covers
/nimbusimage Connection, dataset discovery, metadata, projects
/nimbusimage:annotations Annotation CRUD, geometry helpers, bulk operations
/nimbusimage:images Frame retrieval, composites, z-stacks, crops
/nimbusimage:workers Docker worker discovery, execution, job tracking
/nimbusimage:analyze Properties, export, connections, sharing

The skills use progressive disclosure — Claude loads only what it needs for the current task.

Development

cd nimbusimage
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

# Run unit tests (no backend required)
pytest tests/ --ignore=tests/integration -v

# Run integration tests (requires docker compose up)
pytest tests/integration/ -v -m integration

License

See the project root for license information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nimbusimage-0.1.2.tar.gz (51.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nimbusimage-0.1.2-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

Details for the file nimbusimage-0.1.2.tar.gz.

File metadata

  • Download URL: nimbusimage-0.1.2.tar.gz
  • Upload date:
  • Size: 51.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nimbusimage-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ec04de287306d6ad4d125496137cef91646813d2ff714c1c7a245f522967c8d8
MD5 f57a3b22e3e67e184229e721d3e7d97a
BLAKE2b-256 3680e27d32e906c38815f466f1a1b201276506002b518eca79e3609435f97857

See more details on using hashes here.

Provenance

The following attestation bundles were made for nimbusimage-0.1.2.tar.gz:

Publisher: publish-nimbusimage.yaml on arjunrajlaboratory/NimbusImage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nimbusimage-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: nimbusimage-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 39.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nimbusimage-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 78de26c6f9ed63b2dc5d24cf90796281514ad5a6858452bd25436ffae91ea9d3
MD5 c1d513f46e75e0c03045036f9ed87691
BLAKE2b-256 495fa0c1017e48acffe47619c7a72e58e31ae714962782a251bfeadfa760954b

See more details on using hashes here.

Provenance

The following attestation bundles were made for nimbusimage-0.1.2-py3-none-any.whl:

Publisher: publish-nimbusimage.yaml on arjunrajlaboratory/NimbusImage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page