Skip to content

feat: roi overlays ao - #40

Draft
dpshepherd wants to merge 50 commits into
mainfrom
feat/roi-overlays-ao
Draft

dpshepherd wants to merge 50 commits into
mainfrom
feat/roi-overlays-ao

Conversation

@dpshepherd

Copy link
Copy Markdown
Contributor

Original goal was to automate plotting of ROIs from large samples for manuscript. Found a couple bugs in ROI extraction and fusion, so fixed along the way.

Match processed depths to the first acquired layer using upstream histogram matching. Combine cropped ROI tiles by acquisition depth, retain uint16 histogram bounds, and keep source pixels unchanged. Remove scalar-gain paths and update the associated fixtures, report assertions, CLI help, and documentation together.
Use one unsorted per-channel fit over selected acquisition depths. Remove residual tissue-profile calibration and the maximum of separately normalized depth fits, and invalidate older calibration caches. Retain the existing numerical accuracy targets and validate the full-acquisition worker and saved-field processing paths.
Render the native annotated overview once, then scale the complete image isotropically to the JPEGli encoder limit of 65500 pixels. Write matching PNG and quality-100 4:4:4 JPEG files, preserve physical calibration and source ROI coordinates, and upgrade saved PNG-only overviews without rerendering.
Reuse the unchanged SJS polygon mapping, equal-area subdivision, and intended-center calculations. Add an adapter using production acquisition, AO-plan, registered-footprint and NGFF readers. The SJS script imports these shared calculations.
Add --ao-grid to draw the saved acquisition polygon, nine equal-area cells and intended center stars on the full overview. Preserve display transforms, ROI outlines, physical calibration and the scale bar. Resume can annotate a saved overview without rerendering source tissue.
@github-actions
github-actions Bot marked this pull request as draft November 13, 2026 18:18
Keep overlap uploads and downsampling on the GPU while limiting array lifetimes
to one pair. Remove grow-only staging buffers and release cached FFT plans and
device/pinned scratch between pairs.

Add real-CUDA checks for overlap bounds, GPU downsampling and memory release.
Require an available CUDA registration backend in the manual GPU workflow.

Validation: 78 CPU tests and two focused GPU release cases passed. The broader
GPU run was stopped before completion so ROI processing could resume.
Evaluate Padfield moments sequentially with real-valued GPU FFT correlations
instead of retaining six full complex spectra. Keep only permitted lags for
the final score while preserving the global overlap and variance thresholds.
Keep caller image intensities unchanged.

ROI_001's sixth pair (positions 227 and 564) has a sampled overlap of
48 x 1364 x 380. Each previously padded complex spectrum occupied about
1.5 GiB, so cleanup between pairs could not prevent the within-pair peak.

Add independent normalized-correlation comparisons and a real 512-MiB CUDA
workspace case. Static checks passed; CUDA validation is still running.
Use CuPy real FFT operators directly for the sequential masked correlation.
Avoid importing cupyx.scipy.signal, which emits an experimental rawkernel
warning and prevents backend initialization when warnings are errors.

Multiply spectra in place and release the second spectrum before the inverse
transform to further reduce the temporary workspace.

Validation: CUDA registration imports with warnings treated as errors;
formatting and lint checks passed.
Remove the custom sequential masked-correlation implementation and its new
tests. Remove the extra full masked NCC pass that allocated multiple 1.5-GiB
padded spectra on ROI_001 pair 6. Use the existing cuCIM phase/edge correlation
and SSIM path, keeping GPU overlap uploads, block reduction and pair cleanup.

Update the registration fingerprint to prevent reusing measurements from the
removed masked-correlation path. No unrelated processing is changed.

Validation: CUDA backend imports with warnings treated as errors; formatting,
lint and diff checks passed. Committed without waiting for GPU tests as requested.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant