Draft
Add --bbox_config CLI option for template-space bounding box crops#191
Conversation
Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
…crops Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
akhanf
August 6, 2026 14:30
View session
- target rule wasn't connected, added that in now - script had the wrong transform and used interp_by_blocks directly - instead we can use apply_transform. Note: this requires a zarrnii fix if using imaris datasets (in zarrnii PR #262)
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.
Adds a mechanism to extract cropped NIfTI regions from SPIM zarr data in template space at arbitrary resolution, useful for targeted visualization or downstream analysis without registering the full volume.
Changes
CLI & config (
snakebids.yml,Snakefile)--bbox_configoption accepting a YAML file with a list of named bounding boxesbbox_configs/bbox_cfgs_by_namedictsRules (
patches.smk)extract_bbox_crop— per-bbox/stain rule; output BIDS entities:stain,space(template),res(e.g.20um),desc(bbox name),levelall_bbox_template_crops— standalone target expanding over all bboxes × dataset stainsScript (
extract_bbox_in_template_space.py)Block-wise pull-resampling via zarrnii
interp_by_block. Transform chain:Only the subregion of the source zarr needed per output block is loaded — memory stays bounded at any input level.
Bbox config format
The
use_brain_mask: truespecial case computes the bounding box from the template brain mask non-zero extent, enabling whole-brain resampling at arbitrary resolution.