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.py → get_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
Background
#165 added out-of-range batch coordinate validation to
WorkerClient.process(), so aBatch XY/Z/Timerange naming coordinates the dataset does not have now fails with an actionablesendErrorinstead of a bareKeyErrorfromcoordinatesToFrameIndex(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 bareKeyError. 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 at3f8f2b5, not copied from the branch.Workers that need individual fixes
Each parses batch ranges with
process_range_list/get_batch_informationand then iteratescoordinatesToFrameIndex()/getRegion()itself. Each should validate againstIndexRange(thensendErrorand stop) before its processing loop.workers/annotations/cellori_segmentation/entrypoint.pyworkers/annotations/sam2_automatic_mask_generator/entrypoint.pyget_images_for_all_channelsworkers/annotations/sam2_refine/entrypoint.pyget_images_for_all_channelsworkers/annotations/sam2_propagate/entrypoint.pyget_images_for_all_channelsworkers/annotations/sam2_video/entrypoint.pyget_images_for_all_channelsworkers/annotations/sam_fewshot_segmentation/entrypoint.pyget_images_for_all_channelsworkers/annotations/sam2_fewshot_segmentation/entrypoint.pyget_images_for_all_channelsworkers/annotations/cellpose_train/entrypoint.pyShared chokepoint — fixing it protects most of the SAM callers above:
annotation_utilities/annotation_utilities/annotation_tools.py→get_images_for_all_channels(),coordinatesToFrameIndex()at L453.Separate but adjacent exposure:
workers/annotations/histogram_matching/entrypoint.pyL138 — the reference-image lookup uses user-enteredreference_XY/reference_Z/reference_Timenumber fields, which are not range-checked. fix: handle frames that omit index keys for size-one dimensions #159/fix(channelCheckboxes): report malformed values instead of crashing #162 validated this worker's channel selection (split_channel_selection, L122-133) but left the reference XY/Z/Time coordinates unguarded, so an out-of-range reference position still raisesKeyErrorhere.Already validate — reference patterns, no change needed
workers/annotations/registration/entrypoint.py— validates reference Z/Time againstIndexRange; 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.pyandblob_annulus_intensity_worker— buildrange_z = range(0, IndexZ), filter Z planes, andsendWarningon 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:
WorkerClient(Validate WorkerClient batch coordinates before image access #165) andcrop/registrationdo: any out-of-range coordinate aborts the run.sendWarning, process the rest.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/
interfacepaths 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
WorkerClientfix this extendscoordinatesToFrameIndexitself raise a descriptive exception