Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
| Tests | `python tools/check.py` (pytest, Ruff and the MorphoBricks code rules against `tools/code_rules_baseline.json`, design v0.4 §9); `PYTHONPATH=src python -m pytest -q` for the tests alone |
| Environment | `python -m pip install -e .` (add extras as needed: `.[test]`, `.[notebook]`, `.[torch]`) or `conda env create -f environment.yaml` |

Key dependencies: `numpy`, `scipy`, `tifffile`, `imageio`, and the MorphoBricks bricks `morphobricks-preprocessing` and `morphobricks-normalization` from GitHub at pinned tags (normalization `v0.7.1`; preprocessing `v0.7.0` — Spec ADR 0005 steps 2 and 2b: resolver contract v3, `read_objects`, the conversion helpers; v0.6.1 records the verified mask fingerprint; v0.7.0 raises `RunStoppedError` for a stopped run) (core, required; normalization is declared at the tag the preprocessing tag pins, owner decision D-h, checked by `tests/test_dependency_pins.py`; histograms, the plane table, plane IDs, pooling and normalization parameters are imported from `morphobricks_normalization`, not from their deprecated preprocessing paths). Optional extras: `ipywidgets`, `matplotlib`, `pillow`, `tqdm`, `joblib`, `jl-hidecode` (notebook extra); `torch` (optional `cellpatcher.torch_dataset` adapter only — never a core dependency); `morphobricks-preprocessing[zarr]` at the same tag (`zarr` extra, formerly `preprocessing`: OME-Zarr images and OME-NGFF label masks).
Key dependencies: `numpy`, `scipy`, `tifffile`, `imageio`, and the MorphoBricks bricks `morphobricks-preprocessing` and `morphobricks-normalization` from GitHub at pinned tags (normalization `v0.7.1`; preprocessing `v0.8.0` — Spec ADR 0005 steps 2 and 2b: resolver contract v3, `read_objects`, the conversion helpers; v0.6.1 records the verified mask fingerprint; v0.7.0 raises `RunStoppedError` for a stopped run; v0.8.0 reads large tiled images by window, requires `imagecodecs` and refuses TIFF codecs without a measured memory bound, with no format change) (core, required; normalization is declared at the tag the preprocessing tag pins, owner decision D-h, checked by `tests/test_dependency_pins.py`; histograms, the plane table, plane IDs, pooling and normalization parameters are imported from `morphobricks_normalization`, not from their deprecated preprocessing paths). Optional extras: `ipywidgets`, `matplotlib`, `pillow`, `tqdm`, `joblib`, `jl-hidecode` (notebook extra); `torch` (optional `cellpatcher.torch_dataset` adapter only — never a core dependency); `morphobricks-preprocessing[zarr]` at the same tag (`zarr` extra, formerly `preprocessing`: OME-Zarr images and OME-NGFF label masks).

Current health snapshot (2026-11-17, v0.8.0 release prep: preprocessing `v0.7.0` and normalization `v0.7.1` installed from their tags in a fresh venv, Python 3.13, Linux): `.[test,zarr,notebook]` with CPU `torch` 2.15.0: 3085 passed, 0 skipped (pytest run in two halves of 41 test files, 955 + 2130; code rules and Ruff clean with `python tools/check.py --rules`; the smaller extras were not run locally). CI also runs `.[test]` on `windows-latest` (`pytest-windows`): 2980 passed, 42 skipped on #133, every skip an extra that job does not install (zarr, notebook, torch). Preprocessing refuses Z>1 inputs (2-D planes only), so the tests that built Z-stacks use T.
Current health snapshot (2026-11-19, v0.8.1 release prep: preprocessing `v0.8.0` (`ce1f6c7`) and normalization `v0.7.1` (`fcfaeac`) installed from their tags in a fresh venv, Python 3.13, Linux, editable CellPatcher): `.[test,zarr,notebook]` with CPU `torch` 2.15.0: 3085 passed, 0 skipped (`python tools/check.py` without `PYTEST_ADDOPTS`, one run; code rules and Ruff clean; the smaller extras were not run locally). CI also runs `.[test]` on `windows-latest` (`pytest-windows`): 2980 passed, 42 skipped on #133, every skip an extra that job does not install (zarr, notebook, torch). Preprocessing refuses Z>1 inputs (2-D planes only), so the tests that built Z-stacks use T.

---

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Since v0.2.0 CellPatcher reads image and mask files only through a run of the
(v0.5): describe the experiment and publish its description in the preprocessing notebook, run it
on your experiment first, then point CellPatcher to the run's output folder. A run without a
published description is refused (`A_DESCRIPTION_REQUIRED`). What changed, with the migration notes for the
other bricks, is in the [CHANGELOG](notebooks/CellPatcher/CHANGELOG.md) (v0.2.0rc1 to v0.8.0).
other bricks, is in the [CHANGELOG](notebooks/CellPatcher/CHANGELOG.md) (v0.2.0rc1 to v0.8.1).

- **Normal user / manual workflow:** open `notebooks/CellPatcher/CellPatcher.ipynb` and give it the preprocessing run's output folder.
- **Choosing a patching strategy:** open `notebooks/CellPatcher_Strategy_Examples/CellPatcher_Strategy_Examples.ipynb`: each strategy on one image of your preprocessing run, nothing written.
Expand Down Expand Up @@ -120,7 +120,7 @@ Open the notebook in Colab:
**A release, anywhere (Google Colab included):**

```bash
pip install "cellpatcher[notebook,zarr] @ git+https://github.com/CellMigrationLab/CellPatcher.git@v0.8.0"
pip install "cellpatcher[notebook,zarr] @ git+https://github.com/CellMigrationLab/CellPatcher.git@v0.8.1"
```

The notebook's first cell does this on Colab (pinned to its `RELEASE_TAG`), mounts Google Drive and
Expand Down
2 changes: 1 addition & 1 deletion docs/normalization.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ before.

## The workflow

1. **Install** CellPatcher: the preprocessing (v0.7.0) and normalization (v0.7.1) bricks are core
1. **Install** CellPatcher: the preprocessing (v0.8.0) and normalization (v0.7.1) bricks are core
dependencies. OME-Zarr images need the optional extra `pip install "cellpatcher[zarr]"` (the
notebook's first cell installs it on Google Colab).
2. **Describe the experiment and run the preprocessing notebook** on your experiment folder: publish
Expand Down
2 changes: 1 addition & 1 deletion docs/normalization_contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ brick's

| Rule | Detail |
|---|---|
| Dependencies | `morphobricks-preprocessing` (`v0.7.0` since CellPatcher v0.8.0, `RunStoppedError`; `v0.6.1` in v0.7.1; `v0.6.0` in v0.7.0, Spec ADR 0005 steps 2 and 2b; `v0.5.6` in v0.6.2; `v0.5.5` in v0.6.1; `v0.5.3` in v0.6.0; `v0.5.2` in v0.5.0; `v0.5.1` in v0.4.0; `v0.5.0` in v0.3.0; `v0.4.0` in v0.2.0, `v0.4.0rc5` in v0.2.0rc3, `v0.4.0rc4` in v0.2.0rc2, `v0.4.0rc2` in v0.2.0rc1) and `morphobricks-normalization` (`v0.7.1` since CellPatcher v0.8.0, the tag preprocessing v0.7.0 pins; `v0.7.0` in CellPatcher v0.7.0 and v0.7.1, the tag preprocessing v0.6.0 and v0.6.1 pin; `v0.6.1` in CellPatcher v0.6.1 and v0.6.2, the tag preprocessing v0.5.5 and v0.5.6 pin; `v0.6.0` in CellPatcher v0.6.0, the tag preprocessing v0.5.3 pins; `v0.5.0` in CellPatcher v0.5.0, the tag preprocessing v0.5.2 pins; `v0.4.0` in CellPatcher v0.4.0, the tag preprocessing v0.5.1 pins; `v0.3.4` in v0.2.0 and v0.3.0: the tag preprocessing `v0.5.0` pins; `v0.3.3` in v0.2.0rc3, `v0.3.2` before) are core dependencies, pinned to tags in `setup.py`; normalization at the tag the preprocessing tag pins (owner decision D-h, checked by `tests/test_dependency_pins.py`). The `zarr` extra (`pip install "cellpatcher[zarr]"`, formerly `preprocessing`) installs `morphobricks-preprocessing[zarr]` at the same tag, for OME-Zarr images. Histograms, the plane table, plane IDs, pooling and normalization parameters, which moved to the normalization brick, are imported from `morphobricks_normalization`. |
| Dependencies | `morphobricks-preprocessing` (`v0.8.0` since CellPatcher v0.8.1, lazy windows and `imagecodecs` required, no format change; `v0.7.0` in v0.8.0, `RunStoppedError`; `v0.6.1` in v0.7.1; `v0.6.0` in v0.7.0, Spec ADR 0005 steps 2 and 2b; `v0.5.6` in v0.6.2; `v0.5.5` in v0.6.1; `v0.5.3` in v0.6.0; `v0.5.2` in v0.5.0; `v0.5.1` in v0.4.0; `v0.5.0` in v0.3.0; `v0.4.0` in v0.2.0, `v0.4.0rc5` in v0.2.0rc3, `v0.4.0rc4` in v0.2.0rc2, `v0.4.0rc2` in v0.2.0rc1) and `morphobricks-normalization` (`v0.7.1` since CellPatcher v0.8.0, the tag preprocessing v0.7.0 and v0.8.0 pin; `v0.7.0` in CellPatcher v0.7.0 and v0.7.1, the tag preprocessing v0.6.0 and v0.6.1 pin; `v0.6.1` in CellPatcher v0.6.1 and v0.6.2, the tag preprocessing v0.5.5 and v0.5.6 pin; `v0.6.0` in CellPatcher v0.6.0, the tag preprocessing v0.5.3 pins; `v0.5.0` in CellPatcher v0.5.0, the tag preprocessing v0.5.2 pins; `v0.4.0` in CellPatcher v0.4.0, the tag preprocessing v0.5.1 pins; `v0.3.4` in v0.2.0 and v0.3.0: the tag preprocessing `v0.5.0` pins; `v0.3.3` in v0.2.0rc3, `v0.3.2` before) are core dependencies, pinned to tags in `setup.py`; normalization at the tag the preprocessing tag pins (owner decision D-h, checked by `tests/test_dependency_pins.py`). The `zarr` extra (`pip install "cellpatcher[zarr]"`, formerly `preprocessing`) installs `morphobricks-preprocessing[zarr]` at the same tag, for OME-Zarr images. Histograms, the plane table, plane IDs, pooling and normalization parameters, which moved to the normalization brick, are imported from `morphobricks_normalization`. |
| Version | Installed from GitHub at a pinned commit or tag, recorded in `setup.py` and raised deliberately. |
| Formats | Since v0.2.0 (CP-1) the preprocessing run is read through the brick's `RunInputs` (its design v0.4 §6), which needs `run_manifest.json` manifest version `2` (preprocessing v0.4), or `3` for a run with the brick's `--verify-content` (preprocessing v0.4.0rc5, CellPatcher v0.2.0rc3), or `4` for a described run (preprocessing v0.5.0, CellPatcher v0.3.0, which refuses a run without a published description: `A_DESCRIPTION_REQUIRED`); since preprocessing v0.5.1 only `4` is read, and since preprocessing v0.5.2 (the W3 pins) only `5`, whose file entries record their `channel_ids` (an older manifest is refused, `preprocessing_run_refused`, never converted) and `RunInputs.open` itself refuses a run without a description, and the `plane_histograms.csv` version that brick reads; CellPatcher pins no version of its own. Any run `RunInputs` refuses is an error. |
| Needed for | Normalization (every scope), OME-Zarr images and labels, and plane-by-plane image reading. |
Expand Down
25 changes: 25 additions & 0 deletions notebooks/CellPatcher/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [0.8.1] - 2026-11-19

### Changed
- Version updated from 0.8.0 to 0.8.1
- Dependencies: `morphobricks-preprocessing` moves from `v0.7.0` to `v0.8.0` (core dependency and
the `zarr` extra); `morphobricks-normalization` stays at `v0.7.1`, the tag preprocessing `v0.8.0`
pins. Pin-only release: no CellPatcher code change, and the run folders, `patches.csv` and
`run_config.json` keep their formats (preprocessing `v0.8.0` has no format change). Which planes
can be read changes through preprocessing (below).
- What preprocessing `v0.8.0` changes for CellPatcher users: `imagecodecs` becomes a required
dependency and is installed with CellPatcher. CellPatcher reads every image through
`RunInputs.read_plane`, which now checks the memory of reading all of a plane's channels before
any pixel is read (preprocessing #344) and refuses with `PlaneMemoryError` over preprocessing's memory limit
(default 1 GiB): the largest **compressed** plane accepted drops to about two thirds (RGB `uint8`
deflate tiles), so a plane that read under v0.7.0 can now be refused; the largest
**uncompressed** contiguous plane grows (RGB `uint8` about 146 to 170 MiB per channel). The
bounded readers decode only TIFF codecs with a measured memory bound (uncompressed, deflate, LZMA,
and now also LZW and 8-bit JPEG in the measured form, which v0.7.0 could not read this way); at
any plane size, a TIFF stored with another codec or predictor
(for example PackBits, Zstandard, WebP, JPEG 2000, the floating-point predictor) is refused from
its header with `compression_not_bounded`, naming the fix (save it again uncompressed, deflate,
LZW or LZMA, or as OME-Zarr). Nothing falls back to another decoder.
- Reason: the MorphoBricks bricks must all pin the same core tags (pip refuses two URLs for one package).

---
## [0.8.0] - 2026-11-17

### Changed
Expand Down
6 changes: 3 additions & 3 deletions notebooks/CellPatcher/CellPatcher.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"appears when everything is ready.\n",
"\n",
"> **Colab users:** Step 0 connects your Google Drive (allow access in the window that opens)\n",
"> and installs CellPatcher **v0.8.0** from GitHub, which takes a minute or two. Keep the\n",
"> and installs CellPatcher **v0.8.1** from GitHub, which takes a minute or two. Keep the\n",
"> preprocessing output folder, your experiment and your results on Google Drive: in this\n",
"> notebook your Drive is the folder **/content/drive/MyDrive**. Everything else on the runtime is\n",
"> wiped when it disconnects; then run Step 0 again.\n",
Expand Down Expand Up @@ -95,12 +95,12 @@
"\n",
"# The notebook's version and name, as LabConstrictor's version check reads them\n",
"# (notebooks/notebook_latest_versions.yaml lists the latest version).\n",
"current_version = \"0.8.0\"\n",
"current_version = \"0.8.1\"\n",
"notebook_name = \"CellPatcher\"\n",
"# The release installed from GitHub when the package is missing (Google Colab, or a\n",
"# downloaded notebook). Set to the new tag, with current_version, before each release is\n",
"# tagged, so a tagged notebook installs its own release.\n",
"RELEASE_TAG = \"v0.8.0\"\n",
"RELEASE_TAG = \"v0.8.1\"\n",
"REPOSITORY = \"https://github.com/CellMigrationLab/CellPatcher.git\"\n",
"# The package's extras to install; on Colab also zarr, to read OME-Zarr images.\n",
"EXTRAS = \"notebook\"\n",
Expand Down
6 changes: 3 additions & 3 deletions notebooks/CellPatcher_Pytorch/CellPatcher_Pytorch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"appears when everything is ready.\n",
"\n",
"> **Colab users:** Step 0 connects your Google Drive (allow access in the window that opens)\n",
"> and installs CellPatcher **v0.8.0** from GitHub, which takes a minute or two; Colab already\n",
"> and installs CellPatcher **v0.8.1** from GitHub, which takes a minute or two; Colab already\n",
"> has PyTorch. Keep the CellPatcher output folder on Google Drive: in this notebook your Drive is\n",
"> the folder **/content/drive/MyDrive**. Everything else on the runtime is wiped when it\n",
"> disconnects; then run Step 0 again.\n",
Expand Down Expand Up @@ -79,12 +79,12 @@
"\n",
"# The notebook's version and name, as LabConstrictor's version check reads them\n",
"# (notebooks/notebook_latest_versions.yaml lists the latest version).\n",
"current_version = \"0.8.0\"\n",
"current_version = \"0.8.1\"\n",
"notebook_name = \"CellPatcher_Pytorch\"\n",
"# The release installed from GitHub when the package is missing (Google Colab, or a\n",
"# downloaded notebook). Set to the new tag, with current_version, before each release is\n",
"# tagged, so a tagged notebook installs its own release.\n",
"RELEASE_TAG = \"v0.8.0\"\n",
"RELEASE_TAG = \"v0.8.1\"\n",
"REPOSITORY = \"https://github.com/CellMigrationLab/CellPatcher.git\"\n",
"# The package's extras to install; on Colab also zarr, to read OME-Zarr images.\n",
"EXTRAS = \"notebook,torch\"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"appears when everything is ready.\n",
"\n",
"> **Colab users:** Step 0 connects your Google Drive (allow access in the window that opens)\n",
"> and installs CellPatcher **v0.8.0** from GitHub, which takes a minute or two. Keep the\n",
"> and installs CellPatcher **v0.8.1** from GitHub, which takes a minute or two. Keep the\n",
"> preprocessing output folder and your experiment on Google Drive: in this notebook your Drive\n",
"> is the folder **/content/drive/MyDrive**. Everything else on the runtime is wiped when it\n",
"> disconnects; then run Step 0 again.\n",
Expand Down Expand Up @@ -90,12 +90,12 @@
"\n",
"# The notebook's version and name, as LabConstrictor's version check reads them\n",
"# (notebooks/notebook_latest_versions.yaml lists the latest version).\n",
"current_version = \"0.8.0\"\n",
"current_version = \"0.8.1\"\n",
"notebook_name = \"CellPatcher_Strategy_Examples\"\n",
"# The release installed from GitHub when the package is missing (Google Colab, or a\n",
"# downloaded notebook). Set to the new tag, with current_version, before each release is\n",
"# tagged, so a tagged notebook installs its own release.\n",
"RELEASE_TAG = \"v0.8.0\"\n",
"RELEASE_TAG = \"v0.8.1\"\n",
"REPOSITORY = \"https://github.com/CellMigrationLab/CellPatcher.git\"\n",
"# The package's extras to install; on Colab also zarr, to read OME-Zarr images.\n",
"EXTRAS = \"notebook\"\n",
Expand Down
6 changes: 3 additions & 3 deletions notebooks/notebook_latest_versions.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"CellPatcher":
"CellPatcher": "0.8.0"
"CellPatcher": "0.8.1"
"CellPatcher_Pytorch":
"CellPatcher_Pytorch": "0.8.0"
"CellPatcher_Pytorch": "0.8.1"
"CellPatcher_Strategy_Examples":
"CellPatcher_Strategy_Examples": "0.8.0"
"CellPatcher_Strategy_Examples": "0.8.1"
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="cellpatcher",
version="0.8.0",
version="0.8.1",
package_dir={"": "src"},
packages=find_packages(where="src"),
python_requires=">=3.11",
Expand All @@ -18,9 +18,11 @@
# below adds its OME-Zarr reader at the same tag. v0.6.0 is Spec ADR 0005
# steps 2 and 2b (resolver contract v3, RunInputs.read_objects, the
# conversion helpers); v0.6.1 fixes the checked-fingerprint race; v0.7.0
# adds RunStoppedError / RunReportUnreadableError for a stopped run (#322).
# adds RunStoppedError / RunReportUnreadableError for a stopped run (#322); v0.8.0
# reads large tiled images by window, makes imagecodecs a required dependency (installed
# with it) and refuses TIFF codecs without a measured memory bound (no format change).
"morphobricks-preprocessing @ git+https://github.com/CellMigrationLab/"
"morphobricks-preprocessing@v0.7.0",
"morphobricks-preprocessing@v0.8.0",
# CellPatcher imports the normalization brick directly (plane histograms,
# the plane table, pooling, normalization parameters, SINGLE), so it
# declares it, at the tag the preprocessing tag above pins (owner
Expand Down Expand Up @@ -65,7 +67,7 @@
# is a core dependency.
"zarr": [
"morphobricks-preprocessing[zarr] @ git+https://github.com/CellMigrationLab/"
"morphobricks-preprocessing@v0.7.0",
"morphobricks-preprocessing@v0.8.0",
],
},
)
2 changes: 1 addition & 1 deletion src/cellpatcher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
)
from cellpatcher.types import PatchRegion

__version__ = "0.8.0"
__version__ = "0.8.1"

__all__ = [
"PatchRegion",
Expand Down
Loading