magscope.auto_bead_selection#
Attributes#
Exceptions#
Raised when auto bead matching is canceled between correlation chunks. |
Classes#
Functions#
|
Copy a recent image snapshot in the same orientation shown in the UI. |
|
Return the ROI crop from a viewer-oriented |
|
Compute 2D normalized cross-correlation over valid ROI-sized positions. |
|
|
|
Compute |
|
Compute valid sliding-window sums via a summed-area table. |
|
Mark all top-left positions whose ROI would overlap |
|
Compute 2D normalized cross-correlation over valid ROI-sized positions. |
|
|
|
|
|
Choose a default score threshold that favors the strongest score cluster. |
|
Detect non-overlapping ROI candidates that match the seed ROI template. |
|
Serve auto-bead search requests from a temporary worker process. |
Module Contents#
- exception magscope.auto_bead_selection.AutoBeadSearchCancelled[source]#
Bases:
RuntimeErrorRaised when auto bead matching is canceled between correlation chunks.
- magscope.auto_bead_selection.copy_latest_image(image_bytes: memoryview | bytes | bytearray, image_shape: tuple[int, int], dtype: numpy.dtype) numpy.ndarray[source]#
Copy a recent image snapshot in the same orientation shown in the UI.
- magscope.auto_bead_selection.crop_roi(image: numpy.ndarray, roi: tuple[int, int, int, int]) numpy.ndarray[source]#
Return the ROI crop from a viewer-oriented
(height, width)image.
- magscope.auto_bead_selection.normalized_cross_correlation(image: numpy.ndarray, template: numpy.ndarray) numpy.ndarray[source]#
Compute 2D normalized cross-correlation over valid ROI-sized positions.
- magscope.auto_bead_selection._correlate2d_valid_chunked(image: numpy.ndarray, kernel: numpy.ndarray, *, chunk_rows: int, cancel_check: collections.abc.Callable[[], bool] | None = None, progress_callback: collections.abc.Callable[[int, int], None] | None = None) numpy.ndarray[source]#
Compute
correlate2d(..., mode='valid')in row stripes.
- magscope.auto_bead_selection._window_sum_integral(image: numpy.ndarray, window_shape: tuple[int, int]) numpy.ndarray[source]#
Compute valid sliding-window sums via a summed-area table.
- magscope.auto_bead_selection._mark_blocked_roi(blocked_mask: numpy.ndarray, roi: tuple[int, int, int, int], roi_size: tuple[int, int]) None[source]#
Mark all top-left positions whose ROI would overlap
roi.
- magscope.auto_bead_selection.normalized_cross_correlation_chunked(image: numpy.ndarray, template: numpy.ndarray, *, chunk_rows: int = _DEFAULT_CORRELATION_CHUNK_ROWS, cancel_check: collections.abc.Callable[[], bool] | None = None, progress_callback: collections.abc.Callable[[int, int], None] | None = None) numpy.ndarray[source]#
Compute 2D normalized cross-correlation over valid ROI-sized positions.
- magscope.auto_bead_selection.roi_overlaps(roi_a: tuple[int, int, int, int], roi_b: tuple[int, int, int, int]) bool[source]#
- magscope.auto_bead_selection.roi_is_within_image(roi: tuple[int, int, int, int], image_shape: tuple[int, int]) bool[source]#
- magscope.auto_bead_selection.filter_candidates_by_score_threshold(candidates: Iterable[AutoBeadCandidate], threshold: float) list[AutoBeadCandidate][source]#
- magscope.auto_bead_selection.default_candidate_score_threshold(candidates: Iterable[AutoBeadCandidate]) float[source]#
Choose a default score threshold that favors the strongest score cluster.
- magscope.auto_bead_selection.detect_matching_beads(image: numpy.ndarray, seed_roi: tuple[int, int, int, int], existing_rois: Iterable[tuple[int, int, int, int]], *, chunk_rows: int = _DEFAULT_CORRELATION_CHUNK_ROWS, cancel_check: collections.abc.Callable[[], bool] | None = None, progress_callback: collections.abc.Callable[[int, int], None] | None = None) tuple[numpy.ndarray, list[AutoBeadCandidate]][source]#
Detect non-overlapping ROI candidates that match the seed ROI template.