accommodate new templates from SPIMtemplates workflow#112
accommodate new templates from SPIMtemplates workflow#112
Conversation
uses spim_templates dict inside an exisitng template, with these ones as additional "channels" to the ABAv3 template, since they are generated from data that is already nonlinearly registered to ABAv3.. However the template does drift a bit and is also susceptible to initial registration error, so would be good to do this iteratively in FireANTS, e.g. correct the template to push towards the ABAv3..
There was a problem hiding this comment.
Pull request overview
This PR extends SPIMquant’s Snakemake workflow to optionally use stain-specific “SPIM templates” (generated from SPIMtemplates and already registered to ABAv3) as the registration reference, instead of always using the anatomical template.
Changes:
- Add
spim_templatesentries to the ABAv3 template config and select a registration stain from those when available. - Add a new import rule to fetch/copy the selected SPIM template channel into the local
tpl-{template}space. - Update template-path helpers so registration can reference either
anat.nii.gzor the selected stain template.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
spimquant/workflow/rules/import.smk |
Adds import_template_spim rule to import stain-specific SPIM template channels. |
spimquant/workflow/rules/common.smk |
Makes template path selection depend on whether a SPIM template is being used. |
spimquant/workflow/Snakefile |
Adds logic to detect and prefer SPIM templates when available. |
spimquant/config/snakebids.yml |
Adds ABAv3 spim_templates URLs for YoPro and Iba1. |
| if spim_templates is not None: | ||
| for stain in spim_templates.keys(): | ||
| if stain in stains: | ||
| stain_for_reg = stain | ||
| use_spim_template = True | ||
| break | ||
|
|
||
| else: | ||
| for stain in config["stains_for_reg"]: | ||
| if stain in stains: | ||
| stain_for_reg = stain | ||
| break |
There was a problem hiding this comment.
The stain selection logic only falls back to config["stains_for_reg"] when spim_templates is None. If spim_templates exists but none of its keys are present in stains, stain_for_reg stays None and the workflow errors even though a valid registration stain may exist in config["stains_for_reg"]. After attempting SPIM-template matching, add a fallback pass over config["stains_for_reg"] when no match was found.
uses spim_templates dict inside an existing template, with these ones as additional "channels" to the ABAv3 template, since they are generated from data that is already nonlinearly registered to ABAv3..
Note: still working on optimal template estimation in SPIMtemplates, since the template does drift a bit and is also susceptible to initial registration error, so would be good to do this iteratively in FireANTS, e.g. correct the template to push towards the ABAv3.. Also this
doesn't have shape_avg enabled, andis greedy not SyN..