Skip to content

accommodate new templates from SPIMtemplates workflow#112

Open
akhanf wants to merge 5 commits intomainfrom
spim-templates
Open

accommodate new templates from SPIMtemplates workflow#112
akhanf wants to merge 5 commits intomainfrom
spim-templates

Conversation

@akhanf
Copy link
Member

@akhanf akhanf commented Feb 23, 2026

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, and is greedy not SyN..

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..
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_templates entries 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.gz or 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.

Comment on lines +56 to +67
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
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot create a PR to address this

Copy link
Contributor

Copilot AI commented Mar 4, 2026

@akhanf I've opened a new pull request, #115, to work on those changes. Once the pull request is ready, I'll request review from you.

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.

3 participants