Skip to main content

cp-anywhere

cp-anywhere logo

CellProfiler-compatible cell profiling in Python and the browser, powered by Rust. Correct illumination, segment images, measure cell features, and export analysis-ready tables.

cp-anywhere turns microscopy images into per-cell feature tables without requiring the CellProfiler desktop application. Use image files or NumPy arrays in Python, work with pandas tables, or run the shared measurement engine in a browser through WebAssembly. See the compatibility guide for supported modules and settings.

Usage

To run from this repository, install Rust and uv, then run uv sync --frozen. Run the Python examples with uv run python or in the repository's virtual environment.

For a hands-on tour, read Cell Profiling Anywhere or open the source notebook. The notebook follows a complete Python workflow: illumination correction, segmentation, measurements, plots, and image/table exports. Run uv sync --frozen --group docs first, then select the repository's .venv Python interpreter in your notebook editor.

The simplest way to call cp-anywhere is measure_files, which accepts TIFF/OME-TIFF, PNG, or saved NumPy array file paths directly (or already-loaded arrays) and returns a tidy pandas.DataFrame:

import cp_anywhere

frame = cp_anywhere.measure_files(
    images={"DNA": "dna.tif", "Actin": "actin.tif"},
    objects={"Cells": "cells.tif", "Nuclei": "nuclei.tif"},
)

A single image/object-set pair can skip the dict form entirely:

frame = cp_anywhere.measure_files("dna.tif", "cells.tif")

The same file formats work from the command line:

uv run cp-anywhere \
  --image DNA=dna.tif --image Actin=actin.tif \
  --objects Cells=cells.tif --objects Nuclei=nuclei.tif \
  --output result.json

--output also accepts .csv or .arrow (Arrow IPC/Feather, covering every feature value as one long-form table, with NaN/Infinity kept as real floats instead of JSON's string markers). measure_files's DataFrame can be written the same way with frame.to_feather("result.arrow").

For arrays already in memory, cp_anywhere.measure(...) is the lower-level entry point that returns a MeasurementResult instead of a DataFrame; it has matching to_json/to_csv/to_arrow methods (see the Python API reference).

Segmentation

cp_anywhere.identify_primary_objects(...) segments a 2D grayscale image into labeled objects. You can pass those labels directly to measure. See segmentation coverage for supported settings.

seg = cp_anywhere.identify_primary_objects(dna_image, threshold="otsu")
result = cp_anywhere.measure({"DNA": dna_image}, {"Nuclei": seg.labels})

The segmentation tests compare labels with CellProfiler 4.2.8 on synthetic and real microscopy fixtures.

Preview segmented objects

Use preview_segmentation to draw object outlines on the input image or show the objects as filled colors. The preview does not change the image or labels.

overlay = cp_anywhere.preview_segmentation(seg.labels, dna_image)
colored = cp_anywhere.preview_segmentation(seg.labels, mode="labels")

cp_anywhere.save_array(overlay, "segmentation-preview.png", bit_depth="No conversion")

To inspect the overlay in a notebook, use plt.imshow(overlay) with Matplotlib.

Run a pipeline on multiple fields

Pass a supported CellProfiler pipeline and a mapping from image IDs to named channels. The channel names must match the pipeline. Paths and NumPy arrays both work.

image_sets = {
    "A01-site1": {"DNA": "a01_s1_dna.tif", "Stain": "a01_s1_actin.tif"},
    "A01-site2": {"DNA": "a01_s2_dna.tif", "Stain": "a01_s2_actin.tif"},
}
for field in cp_anywhere.run_batch("pipeline.cppipe", image_sets, workers=2):
    if field.measurements is not None:
        field.measurements.to_parquet(f"{field.image_id}.parquet")

Omit workers for serial execution. With more than one worker, backend="thread" is the default. Use backend="process" in a Python script under an if __name__ == "__main__": guard. Results arrive in input order and retain their image IDs. For custom workflows, use load_pipeline(...).run(...) on a single field or call the individual functions. See the batch experiment and the pipeline import limits.

The package is named cp-anywhere on PyPI, crates.io, and npm. The Rust library uses cp_anywhere in imports. See the cross-runtime pipeline guide.

Metadata

Release files for cp-anywhere 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cp-anywhere 0.0.1
File Size Uploaded Provenance Actions
cp_anywhere-0.0.1.tar.gz 352.0 kB With provenance Details for cp_anywhere-0.0.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for cp-anywhere 0.0.1
File Actions
cp_anywhere-0.0.1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for cp_anywhere-0.0.1-cp311-abi3-win_amd64.whl
cp_anywhere-0.0.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for cp_anywhere-0.0.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
cp_anywhere-0.0.1-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for cp_anywhere-0.0.1-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
cp_anywhere-0.0.1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for cp_anywhere-0.0.1-cp311-abi3-macosx_11_0_arm64.whl
cp_anywhere-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for cp_anywhere-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 4.1 MB

Release files / cp_anywhere-0.0.1.tar.gz

Download URL cp_anywhere-0.0.1.tar.gz
Size 352.0 kB
Tags Source
SHA-256 checksum
How to use checksums
74a144d8379537f9af0789aee5074b4818c2069320750ea030a8995ec5f4c24c
BLAKE2b-256 checksum
How to use checksums
2818a92f5a22c4a88728341d5162f8a90ad4819e7198c5083c6707e56ce4c697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / cp_anywhere-0.0.1-cp311-abi3-win_amd64.whl

Download URL cp_anywhere-0.0.1-cp311-abi3-win_amd64.whl
Size 663.4 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d199b55b18287ad94cad1f3d1c491907db55a4baf80091708214ccf8a6a6101a
BLAKE2b-256 checksum
How to use checksums
a6ab6f4b85b3a35abc4f820f21243c8fe47d11a361d29a996b7fe6ed9835b7ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / cp_anywhere-0.0.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL cp_anywhere-0.0.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 820.0 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
5f053ea936a1ed9c98541ce907293f8bdfb7916de0dfffbcac906d83360b43fc
BLAKE2b-256 checksum
How to use checksums
8b1eb0f9d99843bb8986bd8d21f34ab84baa827059f579e1193abdc40074a8cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / cp_anywhere-0.0.1-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL cp_anywhere-0.0.1-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 767.4 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
694f3bb89afdd04ab99e801a991f57aec9c4c07a7618624c5dfcfff2d86384fb
BLAKE2b-256 checksum
How to use checksums
fa3baea5cf9e92ad2858027e5cca4dbed97b6b347fbcae46ef06597737add669
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / cp_anywhere-0.0.1-cp311-abi3-macosx_11_0_arm64.whl

Download URL cp_anywhere-0.0.1-cp311-abi3-macosx_11_0_arm64.whl
Size 727.6 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8721039c621cbd2e20d5cf58f1160a2cc11c59766906adf24b85a13d375933ce
BLAKE2b-256 checksum
How to use checksums
02c63cb0ceb48e57c2f627d5630a8e4b86c7a73620f39314edfacd4f9a0836f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / cp_anywhere-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl

Download URL cp_anywhere-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl
Size 758.8 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
a1e9e3da95fb73e70f838ddf3de4624e6a4cb10d4c285b611d41debb8e3a817b
BLAKE2b-256 checksum
How to use checksums
a70c5e7318a23a2c3573199a2d95a87c1d17ecbd0301f8f3dbd2d1402ec71011
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for cp-anywhere 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for cp_anywhere-0.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page