diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f824e7..8d50033 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,16 @@ Release notes and migration notes of `morphobricks-normalization`. Numbers are p issues of [CellMigrationLab/morphobricks-normalization](https://github.com/CellMigrationLab/morphobricks-normalization). The decisions are in [docs/plan.md](docs/plan.md) §12. -## Unreleased +## v0.7.1 (2026-11-17) + +Patch release (#104, #105, #108): the per-bin work of integer planes is 1.3–1.5× faster, signed +zero is written as `0.0`, and three existing optical-density helpers are documented as stable API +(contract §3.6). Every output equals v0.7.0's, with two exceptions in written text only: a `-0.0` +is now written as `0.0` (#105), and `np.float64` histogram limits of a caller-built +`PlaneHistogram` are now written as plain numbers (`0.25`; before `np.float64(0.25)`, which no +reader could read). Every `schema_version` is unchanged, and no API or message changes; the +package still imports with NumPy only. Consumers on v0.7.0 can re-pin without code changes; the +recorded `library_version` (settings, range-check and intensity-check provenance) reads `0.7.1`. Signed zero is written as `0.0` (#105; owner decision 17 November 2026, plan N71). Behaviour change for written text only: no computed value, algorithm, API, schema version or message @@ -15,7 +24,11 @@ changes. (`Intensity_Min/MaxIntensity`, `Histogram_BinningMin/Max`, the underflow and overflow means and standard deviations), the `Normalization_Offset/Scale_` columns of `Parameters.to_columns()` and the percentiles of `percentile_name` (which already wrote - `-0.0` as `0`; now through the same helper). + `-0.0` as `0`; now through the same helper). A float plane holding both `-0.0` and `+0.0` + has a `pixel_min` or `pixel_max` of either zero depending on NumPy's `min`/`max`, the element + order and the platform; the same pixels now write the same bytes everywhere. `x + 0.0` + changes no float but `-0.0`; NaN and the infinities are written as before. The in-memory + `PlaneHistogram`, `Parameters` and `ImageSummary` values keep their sign. - **Values handed to a caller who writes them change only at zero** (`positive_zero`): in `ImageSummary.to_row()` and in the run-configuration dictionaries `NormalizationSettings.to_dict()` (`percentile`), `HistogramSettings.to_dict()` @@ -27,12 +40,7 @@ changes. numbers): a NumPy float zero of either sign is now written `0.0` too. Side fix: `np.float64` limits were written as `np.float64(0.25)`, which the reader refuses; they are now written as the Python float's `repr` (`0.25`) and read back. `np.float32` and integer limits are written - as before (`str`). A float - plane holding both `-0.0` and `+0.0` has a `pixel_min` or `pixel_max` of either zero - depending on NumPy's `min`/`max`, the element order and the platform; the same pixels now - write the same bytes everywhere. `x + 0.0` changes no float but `-0.0`; NaN and the - infinities are written as before. The in-memory `PlaneHistogram`, `Parameters` and - `ImageSummary` values keep their sign. + as before (`str`). - **Files that change**: only those that held `-0.0`, now `0.0` in the same cells (they read back as an equal float). No recorded golden or parity table of this repository holds a `-0.0`, and `tools/dump_outputs.py` (default and `--corpus`) gives the same digests as diff --git a/README.md b/README.md index 0ce898a..a30d02d 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ out of scope for now. ## Status -Pre-alpha; the latest release is v0.7.0. The library offers: +Pre-alpha; the latest release is v0.7.1. The library offers: - supported pixel types, bin counts and per-plane histograms (`dtypes`, `histogram`), with a robust range and a range check; - plane records, `plane_histograms.csv` reading and writing and pooling of group statistics (`records`, `csv_io`, `pooling`): schema version 5 since v0.5.0, with channels named by canonical channel ID (ADR 0003; version 4 tables are refused, see the CHANGELOG migration notes); @@ -41,7 +41,11 @@ Pre-alpha; the latest release is v0.7.0. The library offers: - since v0.7.0, the one region checker of every MorphoBricks brick (`regions.check_region`, `RegionEstimate` for a white or stain vector over an empty region) and the shared resolver-version refusal (`contracts.refuse_resolver_version`), MorphoBricks-Spec ADR 0005 - (contract §3.5). + (contract §3.5); +- since v0.7.1, the optical-density helpers `optical_density.optical_density`, + `optical_density.check_white` and `scalar_inputs.rgb_yxc` are stable API (contract §3.6), and + the per-bin work of integer planes runs in NumPy int64 (same outputs, 1.3–1.5× faster); + every written float writes `-0.0` as `0.0` (#105). Release notes and migration notes are in [CHANGELOG.md](CHANGELOG.md). @@ -63,7 +67,7 @@ for key, rows in groups.items(): ## Installation ```bash -pip install "git+https://github.com/CellMigrationLab/morphobricks-normalization.git@v0.7.0" +pip install "git+https://github.com/CellMigrationLab/morphobricks-normalization.git@v0.7.1" ``` For development, from a clone: diff --git a/docs/contract.md b/docs/contract.md index 759a0ca..052e0ac 100644 --- a/docs/contract.md +++ b/docs/contract.md @@ -22,9 +22,9 @@ with modality profiles, purpose rules, colour statistics and references is withd | 1.3 and 6. Channels across columns (`plane_histograms.csv` schema version 3); per-channel columns of 7.1 and 8.1 | Milestone 2b (done; the columns of 7.1 in Milestone 4, done) | | 7. Intensity checks | Milestone 4 (done) | | 1.4 Robust histogram range and range check; `plane_histograms.csv` schema version 4 (6.2) | Milestone 5 (done) | -| 1.5 and 6. Channels by canonical channel ID (`plane_histograms.csv` schema version 5); per-channel columns of 7.1 and 8.1 by ID | Stage 3 S3.2 ([ADR 0003](https://github.com/CellMigrationLab/MorphoBricks-Spec/blob/main/docs/adr/0003-plane-histograms-v5.md); draft, unreleased) | -| 3.5 Regions (`check_region`, `RegionEstimate`) and the resolver-version refusal | [ADR 0005](https://github.com/CellMigrationLab/MorphoBricks-Spec/blob/main/docs/adr/0005-binary-masks.md) step 1 (plan N70; unreleased) | -| 3.6 Stable optical-density helpers (`check_white`, `optical_density`, `rgb_yxc`) | Documented as stable API for preprocessing's H&E tissue mask (P2; no code change; unreleased) | +| 1.5 and 6. Channels by canonical channel ID (`plane_histograms.csv` schema version 5); per-channel columns of 7.1 and 8.1 by ID | Stage 3 S3.2 ([ADR 0003](https://github.com/CellMigrationLab/MorphoBricks-Spec/blob/main/docs/adr/0003-plane-histograms-v5.md); v0.5.0) | +| 3.5 Regions (`check_region`, `RegionEstimate`) and the resolver-version refusal | [ADR 0005](https://github.com/CellMigrationLab/MorphoBricks-Spec/blob/main/docs/adr/0005-binary-masks.md) step 1 (plan N70; v0.7.0) | +| 3.6 Stable optical-density helpers (`check_white`, `optical_density`, `rgb_yxc`) | Documented as stable API for preprocessing's H&E tissue mask (P2; no code change; v0.7.1) | | 9. Validation | With the milestone of each check | Notation: `x` is a pixel value in source units; `n` a pixel count; channels are numbered @@ -1069,12 +1069,13 @@ histograms). Each summary holds the channels of its image by ID (`ImageSummary.c types (`IncompatibleSummariesError`, a `ValueError`). An `ImageSummary` whose per-channel tuples have different lengths is refused when made, and `intensity_checks` refuses summaries with different numbers of channels or different percentile definitions, with the same error. -`ImageSummary.to_row()` gives the columns below as a dictionary, in this order (numbers as -floats, `-0.0` as `0.0` (N71), a blank as `None`, `Histogram_Exact_` as a bool; a -channel the image does not have is not in the row and is blank in a table), and -`summary_columns(channel_ids)` the names -for the experiment's channel IDs, so the calling brick can show the rows as a table or write them; the -library writes no file (N50). The columns are the shared columns `source_relative_path`, +`ImageSummary.to_row()` gives the columns below as a dictionary, in this order (each number +as the summary holds it: floats from `image_summaries`, and a value a caller gave keeps its +type; only a float zero of either sign is replaced by `0.0`, N71; a blank as `None`, +`Histogram_Exact_` as a bool; a channel the image does not have is not in the row and is +blank in a table), and `summary_columns(channel_ids)` the names for the experiment's channel +IDs, so the calling brick can show the rows as a table or write them; the library writes no +file (N50). The columns are the shared columns `source_relative_path`, `condition`, `biological_repeat`, `technical_repeat`, `image_file`, and for each channel ID (§6.1): diff --git a/docs/plan.md b/docs/plan.md index 262835c..529021f 100644 --- a/docs/plan.md +++ b/docs/plan.md @@ -2,7 +2,7 @@ > See also: [Preprocessing follow-up](archive/followup_preprocessing.md) (done) · [CellPatcher follow-up](archive/followup_cellpatcher.md) (done) -**Status:** implemented through v0.7.0 (Milestones 0 to 5 done; later changes in [CHANGELOG.md](../CHANGELOG.md)); design brief simplified on 26 October 2026 (decisions N29–N40, §12), with +**Status:** implemented through v0.7.1 (Milestones 0 to 5 done; later changes in [CHANGELOG.md](../CHANGELOG.md)); design brief simplified on 26 October 2026 (decisions N29–N40, §12), with channels moved into columns on 27 October 2026 (N41–N45). The earlier design with six modalities, two purposes, colour and stain methods and reference targets (N4–N28) is withdrawn where §12 says so. A robust histogram range was added on 28 October diff --git a/pyproject.toml b/pyproject.toml index 29da8db..8240606 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "morphobricks-normalization" -version = "0.7.0" +version = "0.7.1" description = "MorphoBricks normalization brick: per-plane statistics, their file formats, and normalization methods for microscopy images." readme = "README.md" license = "MIT"