Skip to content

Roll out out-of-range coordinate validation to workers that bypass WorkerClient.process() #169

Description

@arjunrajlab

Background

#165 added out-of-range batch coordinate validation to WorkerClient.process(), so a Batch XY/Z/Time range naming coordinates the dataset does not have now fails with an actionable sendError instead of a bare KeyError from coordinatesToFrameIndex (self.map[channel][T][Z][XY]).

That covers only the six workers on the WorkerClient.process() path: cellposesam, cellpose, condensatenet, laplacian_of_gaussian, random_squares, sample_interface.

The workers that parse batch ranges and/or call coordinatesToFrameIndex() directly were never routed through that guard and still crash with a bare KeyError. This issue tracks extending the same protection to them.

This list originated in the (now closed) #143, whose branch carried it as todo/out-of-range-coordinate-validation-rollout.md. Moving it here so it survives the branch. Line references below were re-derived against master at 3f8f2b5, not copied from the branch.

Workers that need individual fixes

Each parses batch ranges with process_range_list / get_batch_information and then iterates coordinatesToFrameIndex() / getRegion() itself. Each should validate against IndexRange (then sendError and stop) before its processing loop.

Worker Batch parse Frame lookup
workers/annotations/cellori_segmentation/entrypoint.py L86-88 L112, L117
workers/annotations/sam2_automatic_mask_generator/entrypoint.py L86-88 via get_images_for_all_channels
workers/annotations/sam2_refine/entrypoint.py L197-199 via get_images_for_all_channels
workers/annotations/sam2_propagate/entrypoint.py L288-290 via get_images_for_all_channels
workers/annotations/sam2_video/entrypoint.py L213-215 via get_images_for_all_channels
workers/annotations/sam_fewshot_segmentation/entrypoint.py L294-296 via get_images_for_all_channels
workers/annotations/sam2_fewshot_segmentation/entrypoint.py L273-275 via get_images_for_all_channels
workers/annotations/cellpose_train/entrypoint.py L257, L263

Shared chokepoint — fixing it protects most of the SAM callers above:

  • annotation_utilities/annotation_utilities/annotation_tools.pyget_images_for_all_channels(), coordinatesToFrameIndex() at L453.

Separate but adjacent exposure:

Already validate — reference patterns, no change needed

  • workers/annotations/registration/entrypoint.py — validates reference Z/Time against IndexRange; intersects parsed batch ranges with the valid ranges.
  • workers/annotations/crop/entrypoint.py — intersects all three batch ranges with the dataset ranges.
  • workers/properties/blobs/blob_intensity_worker/entrypoint.py and blob_annulus_intensity_worker — build range_z = range(0, IndexZ), filter Z planes, and sendWarning on out-of-range.

Open design question

The two policies in the tree disagree, and the rollout should settle it per worker rather than by accident:

Strict is the right default for batch annotation workers (a partially-run batch that reports success is the failure mode #159 was chasing), but the property workers' filter-and-warn is deliberate and should probably stay.

Lower-risk, not in scope unless convenient

Preview/interface paths that load a single tile — vulnerable only if a user hand-edits batch params: random_point, random_point_annotation_M1, annulus_generator_M1, gaussian_blur, rolling_ball, deepcell, stardist, laplacian_of_gaussian (preview path).

Property workers that iterate annotation-sourced locations rather than user batch ranges are lower risk, since the locations come from existing annotations.

Related

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