feat: allow negative FOV overlap to introduce spacing between tiles#555
Open
mpiersonsmela wants to merge 1 commit into
Open
feat: allow negative FOV overlap to introduce spacing between tiles#555mpiersonsmela wants to merge 1 commit into
mpiersonsmela wants to merge 1 commit into
Conversation
The FOV Overlap spinbox in flexible and wellplate multipoint widgets
previously rejected negative values (setRange(0, 99)). The downstream
math already handles negatives correctly:
step_size_mm = fov_size_mm * (1 - overlap_percent / 100)
A negative overlap simply produces a step larger than the FOV size,
spacing tiles apart rather than overlapping them — useful for sparse
sampling. The only thing blocking the feature was the spinbox bound
(and the matching ge=0 in the MCP server's Pydantic field).
Changes:
- widgets.py (FlexibleMultiPointWidget): setRange(0, 99) -> (-1000, 99)
- widgets.py (WellplateMultiPointWidget): setRange(0, 99) -> (-1000, 99)
- microscope_control_server.py: Field(..., ge=0, le=50) -> ge=-1000, le=99
(also widens the upper bound to match the existing UI range)
A lower bound of -1000% gives a step size of up to ~11x the FOV —
effectively unlimited for any realistic plate. Out-of-bounds FOVs
generated by extreme spacing are already filtered downstream by
ScanCoordinates.validate_coordinates() against SOFTWARE_POS_LIMIT,
so no additional bounds checking is needed. The geometry_utils.py
helpers already guard against step_size <= 0 for the pathological
overlap >= 100% case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Allows the FOV Overlap spinbox in both Flexible and Wellplate multipoint acquisition modes to accept negative values, which introduce spacing between adjacent FOVs (useful for sparse sampling).
Motivation
This is useful for sparse imaging over a large well, in cases where cells may not be evenly distributed (so looking at the center of the well may not be representative).
Today the spinbox is bounded
setRange(0, 99). The downstream math already does the right thing for negatives:A negative overlap (e.g.
-50%) produces a step ~1.5× the FOV — tiles end up spaced apart rather than overlapping. The only thing blocking the feature was the input bound.Changes
software/control/widgets.py—FlexibleMultiPointWidget:setRange(0, 99)→setRange(-1000, 99)software/control/widgets.py—WellplateMultiPointWidget:setRange(0, 99)→setRange(-1000, 99)software/control/microscope_control_server.py— MCP server'soverlap_percentPydantic field:ge=0, le=50→ge=-1000, le=99so YAML / API callers can also pass negative overlap. (Note: the previousle=50was already inconsistent with the UI bound of99; this aligns them.)A lower bound of
-1000%gives a step size of up to ~11× the FOV — effectively unlimited for any realistic plate, while keeping the spinbox UI well-behaved.Safety
ScanCoordinates.validate_coordinates()againstSOFTWARE_POS_LIMIT, so no additional bounds checking is needed.control/core/geometry_utils.pyalready guardsstep_size <= 0for the pathologicaloverlap >= 100%case.Test plan
-50in both wellplate and flexible mode; live FOV preview shows tiles spaced ~1.5× FOV apart-500) don't crash near stage limits — out-of-range FOVs are silently droppedoverlap_percent: -25passes Pydantic validation10%) behaves unchanged — regression check🤖 Generated with Claude Code