Skip to content

Respect QuPath ROI Z/T planes when exporting selected areas and RegionOf masks #21

Closed

Description

@guijacquemet

Confirmed contract: QuPath 0.7.0 preserves ROI image planes

QuPath ROIs carry their own Z and T coordinates. QuPath's RegionRequest.createInstance(path, downsample, Collection<ROI>) throws IllegalArgumentException for ROIs on different ImagePlanes:

LabConstrictor deviation

The extension's selectionArea() combines all selected annotation bounds without checking ROI.imagePlane, then assigns the viewer's Z/T to the exported rectangle. selectionMask() similarly paints all selected 2D ROI shapes into the same mask. The exported image, however, is requested from one Z/T plane via LcArea.request().

A selected annotation on Z=1 can therefore define the crop or supply a label in an image exported at viewer Z=0. Multiple selected annotations from different time points are likewise flattened into one exported mask without indicating that they refer to different planes. This is a scientific-data mismatch, not merely a display issue.

Proposed fix

Apply an explicit image-plane policy consistently to area selection and RegionOf masks. Prefer to reject mixed Z/T selections with an actionable message, or filter to the current viewer plane with clear UI indication. If single-plane selection does not match the viewer, either switch to the annotation's plane deliberately or refuse it. Do not silently mix planes.

Acceptance criteria

  • Single annotation at viewer Z/T is exported correctly.
  • Annotation at a different Z or T cannot silently define a crop/mask for the current plane.
  • Two annotations with different Z or T are rejected or explicitly filtered according to a documented policy.
  • The exported TIFF's plane, generated region mask and restored result annotations all use the same image plane.
  • Add QuPath 0.7 GUI fixture with two planes and scripted selection across planes; check exported pixel values and annotations.

Priority: P1 — possible incorrect scientific image/region pairing. Verified against the actual extension and QuPath v0.7.0 Java source. A running QuPath regression test is still needed.

Activity

  1. added a commit that references this issue on Oct 13, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions