Skip to content

Commit a474236

Browse files
committed
Integrate longitudinal template generation into rbc (Stage 2 of #301)
Ports scripts/build_robust_template.py into the rbc package layout so the template stage matches the rest of the pipeline and gets test coverage: - core/longitudinal/freesurfer.py: generate_robust_template + fs_to_itk_xfm via niwrap freesurfer + rbc.core.fsl2itk (no c3d). - workflows/longitudinal/template.py: LongitudinalTemplateOutputs + generate_subject_template(). - bids/longitudinal/template.py: discover_template_inputs + export_template; xfm output naming switched to sub-X_ses-longitudinal_from-Y_to-longitudinal_mode-image_xfm.txt. resolve_longitudinal_{anat,func} updated to query by from+to extras. - orchestration/longitudinal/template.py: per-subject loop. Fixes #19 (per-subject volume check now inside the loop, not on the whole df). - cli/longitudinal/ becomes a package with nested subparsers and a ``long`` alias. ``rbc longitudinal template`` is the new subcommand; the legacy --anatomical/--functional flow lives at ``rbc longitudinal process`` until Stage 3 splits it. - noit=True ported as-is with TODO referencing #302. - Drops the FS license requirement entirely: orchestration sets the documented SURFER_SIDEDOOR bypass on the runner environ, since mri_robust_template's chklc() returns immediately when the var is set. - Deletes scripts/build_robust_template.py. Unit tests cover filename mapping, the per-subject single-volume guard, template input discovery, BIDS export naming, and the new CLI wiring (including the ``long`` alias). Tier-2 integration test for ``rbc longitudinal template`` deferred: needs the ds000114 multi-session fixture infrastructure (download script + CI cache + conftest), which is substantial enough to land in a separate PR. Existing ``pytest -m 'integration and not slow'`` collects 0 tests today, so no regression risk.
1 parent ac8903f commit a474236

14 files changed

Lines changed: 881 additions & 373 deletions

File tree

scripts/build_robust_template.py

Lines changed: 0 additions & 358 deletions
This file was deleted.

src/rbc/bids/longitudinal/anatomical.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from typing import TYPE_CHECKING
66

7-
from rbc.bids import Suffix, TemplateSpace
7+
from rbc.bids import Suffix, TemplateSpace, bids_safe_label
88

99
if TYPE_CHECKING:
1010
from pathlib import Path
@@ -48,7 +48,7 @@ def resolve_longitudinal_anat(
4848
tpl_df,
4949
suffix="xfm",
5050
extension=".txt",
51-
extra={"from": ses},
51+
extra={"from": bids_safe_label(ses), "to": "longitudinal"},
5252
),
5353
"brain": anat_q.expect(anat_df, suffix=Suffix.T1W, desc="brain"),
5454
"brain_mask": anat_q.find(anat_df, suffix=Suffix.MASK, desc="T1w"),

src/rbc/bids/longitudinal/functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from typing import TYPE_CHECKING
66

7-
from rbc.bids import Suffix
7+
from rbc.bids import Suffix, bids_safe_label
88

99
if TYPE_CHECKING:
1010
from pathlib import Path
@@ -41,7 +41,7 @@ def resolve_longitudinal_func(
4141
tpl_df,
4242
suffix="xfm",
4343
extension=".txt",
44-
extra={"from": ses},
44+
extra={"from": bids_safe_label(ses), "to": "longitudinal"},
4545
),
4646
"bold_to_anat_itk": func_q.expect(
4747
func_df,

0 commit comments

Comments
 (0)