Skip to content

Record the image ROI convention for operations taking ROI parameters #99

Closed

Description

@PierreRaybaut

Problem

Since #89, the selection of image pixels by regions of interest (rule sigima.image.roi.pixel_centers, IMAGE_ROI_CONVENTION) is recorded in the execution context of a call only when an input image carries regions of interest (image_roi_convention(inputs)).

Four image operations take their regions of interest as parameters (ROI2DParam or a list of them) and are typically called on images without attached ROIs:

  • extract_roi, extract_rois;
  • erase;
  • offset_correction.

Their result also depends on the convention (Sigima 1.4 selects the pixels whose centers lie in the rectangle instead of rounding its bounds: the tests of erase and offset_correction were updated accordingly in #84), but:

  • describe_call returns an empty context for them;
  • prepare_execution(..., context=...) accepts a replay whose context was recorded before Sigima 1.4 ({} or {"x_alignment": None}), so that a replay of such an activity reports a different result without telling why, instead of being refused (unsupported_context);
  • nothing being recorded, a future change of the convention would not be detected either.

DataLab erases areas and extracts ROIs with ROIs defined graphically, never attached to the image, so this is the ordinary path.

Proposal

The dependency on the convention is a property of the operation: an operation whose contract takes image ROI parameters (a parameter of class ROI2DParam, single or list) depends on it whatever its inputs.

  • image_roi_convention(inputs, contract=None) also returns the rule when the contract has an image input and a ROI2DParam parameter;
  • describe_call and prepare_execution pass the contract, so that the rule is recorded and checked for these operations too;
  • no contract version is increased: the rule itself (version 1) is unchanged, it is recorded in more cases;
  • tests: a replay of extract_roi, extract_rois, erase and offset_correction on an image without ROI, with a context recorded before Sigima 1.4, is refused; signal ROIs (ROI1DParam) are not concerned;
  • documentation (guidelines, user guide, release notes) updated.

Reported by an independent review of Sigima 1.4 (unreleased).

Activity

  1. PierreRaybaut commented on Oct 26, 2026

    @PierreRaybaut
    ContributorAuthor

    Fixed by #100 (merged into develop).

  2. added this to the v1.4.0 milestone on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions