Repository navigation
Add cohort template building and export analysis levels - #212
Merged
Merged
Conversation
- cohort_template: build a multivariate (all stains) cohort template with FireANTs from subjects registered to --template, optionally pooling other SPIMquant output dirs; register the original template anat to the cohort template (greedy affine+deformable) and warp its atlases and mask into cohort template space, with a regqc report. - cohort_template_export: write template_description.json, a SPIMquant templates: config snippet and buildinfo tarball, and optionally upload to a Zenodo deposition via snakemake-storage-plugin-zenodo. - FireANTs runs in its own conda env (envs/fireants.yaml) since its PyPI pins conflict with SPIMquant's simpleitk. - pixi.lock regenerated (also upgrades lock format v6 -> v7). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- shape_avg now defaults to false: it adds a full-resolution registration per iteration, OOMs at 25um on a 40GB GPU, and gave a worse subject fit - --cohort-template-resample-mm resamples subject images to an isotropic voxel size before template building, to cut memory and run time (e.g. with a finer --cohort-template-level) - set PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True for torchrun, to avoid OOM from fragmentation after a few subjects - add fireants-fused-ops (akhanf/khanlab) to the gpu environment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The exported tpl-{name}_spimquant.yml now selects the template (template:)
and points at the exported files' absolute paths (or the Zenodo URLs), so
it can be passed to any run with --configfile, without editing
snakebids.yml. Built-in --template choices are added by PR instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 two analysis levels for building a study-specific SPIM template with FireANTs and preparing it for use as a
--templatein later runs. Seedocs/howto/cohort_template.md.cohort_template--template. Each stain is resampled to template space at--cohort-template-level(default--registration_level).--cohort-template-stains). Every stain template therefore shares the same space.--cohort-template-extra-inputs.--cohort-template-n-gpus.reg_qc_report.pynow takes its title fields from params when the rule has no matching wildcards.cohort_template_exporttemplate_description.json, a buildinfo tarball, andtpl-{name}_spimquant.yml: a config file that adds and selects the template, so any run can use it with--configfile(external users). Making it a built-in--templatechoice is done by a separate PR.--cohort-template-zenodo-deposition).Environment
fireants(khanlab fork) andfireants-fused-ops1.2.0 are dependencies of thegpupixi feature, both fromakhanf/khanlab. Run this level withpixi run -e gpu spimquant ....pixi.lockis regenerated, which also upgrades the lock format from v6 to v7.GPU memory and defaults
I tested on an 18-subject PI cohort (mouse_app_mapt_apoe, level 5, ABAv3 25 µm) on a 40 GB A100:
cohort_template.fireants.shape_avgnow defaults tofalse. It adds a full-resolution registration per iteration and runs out of memory at 25 µm, even with the fused ops. Without it, every subject fit the template better, and drift from ABAv3 stayed about the same.--cohort-template-resample-mmresamples subject images to an isotropic voxel size before building. It is off by default. It's meant for cutting memory and run time, e.g. with a finer--cohort-template-level.PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True. Without it, fragmentation caused out-of-memory errors after about 14 subjects.Test plan
cohort_templatecompletes end to end on the cohort above in all three configurations.--cohort-template-resample-mm 0.05gives 228×264×160 inputs at 50 µm, and the generated FireANTs config hasshape_avg: false.pixi install -e gpuinstallsfireants-fused-opsfrom the channel, and FireANTs uses it.cohort_template_export(local, no upload) onnoshape50; a participant run on one subject with the exported--configfileregisters cleanly (NCC 0.86 to the template, regqc looks good).--storage-zenodo-sandbox):noshape50export files upload, with sizes matching the local files. In sandbox mode the exported config still points at zenodo.org URLs.🤖 Generated with Claude Code