Skip to content

Fix 1.4.0 review issues: non-uniform analysis results, empty ROI extraction, empty radial profile, dependency docs - #110

Merged
PierreRaybaut merged 4 commits into
developfrom
fix/release-1.4-review
Oct 30, 2026
Merged

PierreRaybaut merged 4 commits into
developfrom
fix/release-1.4-review

Conversation

@PierreRaybaut

Copy link
Copy Markdown
Contributor

Fixes from a review of Sigima 1.4.0 before its release (one commit per issue).

Summary

Analysis results of non-uniform images (95cb972)

compute_geometry_from_obj converted the pixel indices returned by the image analyses with dx, dy, x0 and y0, whatever the coordinates of the image. These values do not describe images with non-uniform coordinates, so the results of centroid, enclosing_circle, peak_detection, contour_shape, blob_dog, blob_doh, blob_log, blob_opencv and hough_circle_peaks were:

  • given in pixel indices (default dx = dy = 1, x0 = y0 = 0). Example: the centroid of a blob at pixel (51, 51) was (51, 51) instead of (58.4, 57.6);
  • or computed with a stale uniform calibration left over by switch_coords_to("non-uniform"). Example: 35.5 instead of 72.5.

For non-uniform coordinates, the indices (offset by the first pixel of the ROI, in index space) are now converted with axis_to_physical. Radii and semi-axes are scaled by the local pixel size at the shape center. The conversion of images with uniform coordinates is unchanged (bit-identical). The nine contracts are at version 2.

ROIs holding no pixel (fdfcf28)

extract_roi and extract_rois silently created an empty image when the regions of interest held no pixel of the image. For example, 5 of the 9 cells of the default ROI grid on a 4×4 image hold no pixel. A rectangle outside the image or with no width does the same, and so does a circle passing between pixel centers. They now raise an explicit ValueError. Inputs that were accepted are now refused, so both contracts are at version 2. The mask of extract_rois is computed once. generate_image_grid_roi is unchanged: the DataLab grid editor relies on it.

Radial profile of an empty image (3481b82)

get_radial_profile failed on empty data with an obscure NumPy error (zero-size array to reduction operation maximum). It now raises an explicit ValueError. The contract is unchanged, since these inputs were already refused.

Dependency documentation (582d274)

requirements.txt and doc/requirements.rst still listed guidata >= 3.16.0 after 8c51eaa. They are regenerated with guidata.utils.genreqs, and the French catalogs follow. The release notes now state the guidata 3.17.0 requirement.

Release notes

  • New bug-fix entries, with their French translations.
  • The "Operation contract versions" entry lists the contracts increased after the 1.4 exception.

Validation

  • New geometry_nonuniform_unit_test.py (16 tests):

    • centroid and peaks on irregular coordinates, with and without ROI;
    • stale calibration;
    • local scaling of radii and semi-axes;
    • uniform vs. equivalent non-uniform results for every shape kind, with NaN padding kept;
    • exact regression of the uniform conversion.

    The non-uniform tests fail on develop.

  • New tests for the extraction of ROIs holding no pixel (uniform and non-uniform, grid cells) and for the radial profile of empty images. test_empty_image_roi, which expected an empty image, now expects the refusal.

  • Full suite: 2389 passed. pytest --qualification-report: no problems; the 11 increased contracts are qualified at version 2 with exact replays.

Follow-up

DataLab-Platform/DataLab: branch fix/release-1.4-review (CI uses this Sigima branch). It regenerates the Desktop families reference file and adds the release notes.

The Web families reference file of DataLab still records centroid and peak_detection in version 1: these activities are refused, as expected, until DataLab-Web regenerates it.

pyproject.toml requires guidata >= 3.17.0 since 8c51eaa, while
requirements.txt and the dependency table of the documentation still
listed 3.16.0. Both are regenerated with guidata.utils.genreqs, the French
documentation catalogs follow, and the release notes state the new
requirement.

Assisted-by: Claude Opus 5.5
get_radial_profile failed on empty data with an obscure NumPy error
("zero-size array to reduction operation maximum"), e.g. on the image
extracted from a ROI holding no pixel. It now raises an explicit
ValueError. The contract of radial_profile is unchanged: these inputs were
already refused.

Assisted-by: Claude Opus 5.5
extract_roi and extract_rois silently created an empty image when the
regions of interest held no pixel of the image: e.g. the cells of a ROI
grid narrower than a pixel (5 cells of 9 on a 4x4 image with the default
grid), a rectangle outside the image or with no width, or a circle passing
between pixel centers. They now raise an explicit ValueError.

Inputs that were accepted are now refused: the contracts of extract_roi
and extract_rois are increased to version 2. The mask of extract_rois is
computed once. The test that expected an empty image for an empty ROI now
expects the refusal.

Assisted-by: Claude Opus 5.5
…oordinates

compute_geometry_from_obj converted the pixel indices returned by the
analysis functions with dx, dy, x0 and y0 whatever the coordinates of the
image. These values do not describe images with non-uniform coordinates:
the results (centroid, enclosing circle, peaks, contours, blobs, Hough
circles) were given in pixel indices, or according to a former uniform
calibration left after switch_coords_to("non-uniform").

For non-uniform coordinates, the indices (offset by the first pixel of the
ROI) are now converted with axis_to_physical, and radii and semi-axes are
scaled by the local pixel size at the shape center. The conversion of
images with uniform coordinates is unchanged (bit-identical results).

The results change for non-uniform images: the contracts of centroid,
enclosing_circle, peak_detection, contour_shape, blob_dog, blob_doh,
blob_log, blob_opencv and hough_circle_peaks are increased to version 2.

Assisted-by: Claude Opus 5.5
@PierreRaybaut
PierreRaybaut merged commit 0cce292 into develop Oct 30, 2026
6 checks passed
@PierreRaybaut
PierreRaybaut deleted the fix/release-1.4-review branch October 30, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant