Add per-subject bias-corrected intensity histogram QC#156
Draft
Add per-subject bias-corrected intensity histogram QC#156
Conversation
Agent-Logs-Url: https://github.com/khanlab/SPIMquant/sessions/81efff74-dbee-4b61-bae9-8536884fc75c Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
…terpolation comment Agent-Logs-Url: https://github.com/khanlab/SPIMquant/sessions/81efff74-dbee-4b61-bae9-8536884fc75c Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
akhanf
April 10, 2026 15:43
View session
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 QC rule that generates a per-subject, per-stain intensity histogram from bias-field-corrected intensities sampled patch-wise from within the brain mask — avoiding the cost of processing the full zarr volume.
Changes
segmentation.smk/n4_biasfield.py: Addbiasfieldome.zarr output to then4_biasfieldrule (mirrors existinggaussian_biasfieldbehaviour) by passingupsampled_ome_zarr_pathtoapply_scaled_processing.qc.smk— new ruleqc_bias_corrected_histogram: Takes the raw SPIM zarr, the downsampled bias field ome.zarr (keyed oncorrection_method, works for bothn4andgaussian), and the brain mask NIfTI. Parameterised via existingn_patches_per_label,patch_size, andpatch_seedconfig keys.qc_bias_corrected_histogram.py— new script:ZarrNiiAtlas(no TSV needed) and callssample_region_patchesto draw random patch centres in physical space.registration_levelwithin its pyramid (covering the same physical extent withpatch_size / 2**registration_levelvoxels).scipy.ndimage.zoom(order=1)(linear; avoids ringing on a smooth field).qc_intensity_histogram.Snakefile: Adds bias-corrected histograms toall_qcforstains_for_seg, gated ondo_seg.