Skip to content

Move analysis results exactly with flipped and rotated pixels - #426

Merged
PierreRaybaut merged 3 commits into
fix/review-2026-10-24from
fix/pixel-center-convention
Oct 24, 2026
Merged

PierreRaybaut merged 3 commits into
fix/review-2026-10-24from
fix/pixel-center-convention

Conversation

@PierreRaybaut

Copy link
Copy Markdown
Contributor

Summary

Follow-up of the pixel center convention (DataLab-Platform/Sigima#83, DataLab-Platform/SigimaX#21). Stacked on #425.

Analysis results after flips and rotations

After a flip, a quarter turn or a transposition, the analysis results of an image (centroids, peaks, contours...) were moved about the center of the result image with a ±π/2 rotation for quarter turns: one pixel off, wrong by up to the image size for quarter turns of non-square or offset images (44 px on a 40×64 image), and wrong for non-uniform coordinates. GeometricTransformWrapper now passes the source image and apply_geometry_transform uses Sigima's transformer.transform_like_image, i.e. results move exactly with the pixels.

Offset correction area

The background area chosen in Processing > Level adjustment > Offset correction was truncated to integers (leftover of integer ROI2DParam items): wrong for calibrated images and empty when smaller than one unit. It is now passed unchanged.

Review of other usages

profiledialog (inclusive indices, shapes drawn center to center), roieditor (SigimaX adapters only), plothandler (image extent comparison for display only): consistent with the convention, unchanged.

Docs

Release notes 1.4 (rectangular ROI selection; fixes) with French translations.

Tests

  • geometry_transform_unit_test.py: corrected oracle (mirror about the center of the pixel grid, quarter turns = transposition + mirror), ROIs now also checked for quarter turns; new tests: results stay on the pixel they describe (uniform anisotropic offset non-square and non-uniform) and equal the results recomputed on the transformed image. 8 of them fail without the fix.
  • offsetcorrection_app_test.py: calibrated image, removed offset = mean of the selected area (fails without the fix).
  • Full suite locally with the Sigima/SigimaX branches: 1166 passed, 1 timeout in preview_executor_unit_test under heavy load (passes when rerun).

…xels

After a flip, a quarter turn or a transposition, the analysis results of
the image (centroids, peaks, contours...) were moved about the center of
the result image (xc, yc), with a rotation of +/-pi/2 for quarter turns:
this was one pixel off (former xc/yc), wrong by up to the image size for
quarter turns of non-square or offset images (44 pixels on a 40x64 image),
and wrong for non-uniform coordinates. GeometricTransformWrapper now passes
the source image, and apply_geometry_transform moves the results with
Sigima's transformer.transform_like_image, i.e. exactly as the pixels.

The expected values of the existing tests are corrected (mirror about the
center of the pixel grid; quarter turns as transposition + mirror) and ROIs
are now also checked for quarter turns. New tests check that a result
stays on the pixel it describes (uniform anisotropic offset non-square and
non-uniform images) and equals the result recomputed on the transformed
image.

Assisted-by: Claude Opus 5.5
The background area selected in the offset correction dialog was truncated
to integer coordinates before being passed to the computation, a leftover
of when ROI2DParam coordinates were integers. For images whose coordinates
are not in pixels (e.g. in millimeters), the area was wrong, and empty
when smaller than one unit. The rectangle is now passed unchanged.

Assisted-by: Claude Opus 5.5
Describe the new selection of rectangular ROIs and the fixes of ROIs,
annotations and analysis results after flips and rotations, of extracted
ROI coordinates, of analysis results in ROIs and of the offset correction
area. Update the French translations.

Assisted-by: Claude Opus 5.5
@PierreRaybaut

Copy link
Copy Markdown
Contributor Author

The test workflows only run for PRs targeting main, develop or release, so they were dispatched manually on this branch (they install the Sigima and SigimaX branches of the same name):

@PierreRaybaut
PierreRaybaut merged commit ffe7545 into fix/review-2026-10-24 Oct 24, 2026
6 checks passed
@PierreRaybaut
PierreRaybaut deleted the fix/pixel-center-convention branch October 24, 2026 10:46
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