Skip to content

Add vessels mask skeletonization rule using overlap-aware chunked processing#166

Merged
akhanf merged 6 commits into
mainfrom
copilot/add-skeletonization-rule
May 15, 2026
Merged

Add vessels mask skeletonization rule using overlap-aware chunked processing#166
akhanf merged 6 commits into
mainfrom
copilot/add-skeletonization-rule

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

This adds a vessels workflow step to generate a skeletonized .ozx mask from the vessel mask, using the same overlap-aware chunking pattern as signed distance transform. The implementation uses dask.map_overlap with scikit-image skeletonization to avoid chunk-boundary artifacts.

  • Workflow integration (vessels rule)

    • Added skeletonize_vessels_mask in spimquant/workflow/rules/vessels.smk.
    • Input: datatype=vessels, suffix=mask.ozx, desc={desc}.
    • Output: datatype=vessels, suffix=mask.ozx, desc={desc}+skeleton.
    • Configured overlap depth and resources consistent with existing heavy chunked vessel transforms.
  • Skeletonization implementation (new script)

    • Added spimquant/workflow/scripts/skeletonize_vessels_mask.py.
    • Reads vessel mask via ZarrNii, applies per-channel skeletonization in chunked blocks via da.map_overlap, and writes OME-Zarr output.
    • Preserves project mask convention (foreground=100) in output voxels.
  • Robustness guardrails

    • Added explicit dimensionality check for expected (c, z, y, x) layout before processing.
    • Documented overlap semantics for channel vs. spatial axes.
skel_darr = da.map_overlap(
    skeletonize_block,
    znimg.darr,
    depth={0: 0, 1: overlap_depth, 2: overlap_depth, 3: overlap_depth},
    boundary=0,
    dtype=np.uint8,
)

@akhanf akhanf marked this pull request as ready for review May 15, 2026 19:51
@akhanf akhanf merged commit d7f0a44 into main May 15, 2026
2 checks passed
@akhanf akhanf deleted the copilot/add-skeletonization-rule branch May 15, 2026 19:52
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.

2 participants