Skip to content

Commit cb1cd14

Browse files
committed
Rename CompositeTransforms to RegistrationOutputs and improve tests
The NamedTuple now includes a brain image alongside transforms, so the old name was misleading. Also adds a comment explaining the manual _Warped.nii.gz path, asserts the warped brain exists in the integration test, and adds a unit test verifying the MNI-space BIDS filename.
1 parent ba0acfb commit cb1cd14

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

tests/integration/test_anatomical.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def test_tissue_segmentation(test_subject: TestSubjectData) -> None:
3535
@pytest.mark.slow
3636
def test_registration(test_subject: TestSubjectData) -> None:
3737
"""Test anatomical registration."""
38-
composite_xfms = anatomical.ants_registration(in_file=test_subject.t1w)
39-
assert composite_xfms.forward.exists()
40-
assert composite_xfms.inverse.exists()
38+
reg_outputs = anatomical.ants_registration(in_file=test_subject.t1w)
39+
assert reg_outputs.brain.exists()
40+
assert reg_outputs.forward.exists()
41+
assert reg_outputs.inverse.exists()

tests/unit/bids/test_exports.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ def func_bids(pipe_ctx: RunContext) -> Bids:
128128
class TestExportAnatomical:
129129
"""Tests for export_anatomical."""
130130

131-
def test_creates_8_files(
131+
def test_creates_9_files(
132132
self, anat_bids: Bids, workdir: Path, pipe_ctx: RunContext
133133
) -> None:
134-
"""All 8 anatomical outputs are saved."""
134+
"""All 9 anatomical outputs are saved."""
135135
outputs = _make_anat_outputs(workdir)
136136
export_anatomical(anat_bids, outputs)
137137
saved = list(pipe_ctx.output_dir.rglob("*.*"))
@@ -147,6 +147,21 @@ def test_filenames_contain_expected_entities(
147147
assert "sub-01" in p.name
148148
assert "ses-baseline" in p.name
149149

150+
def test_template_space_t1w_has_space_entity(
151+
self, anat_bids: Bids, workdir: Path, pipe_ctx: RunContext
152+
) -> None:
153+
"""Template-space T1w is saved with the MNI space entity."""
154+
outputs = _make_anat_outputs(workdir)
155+
export_anatomical(anat_bids, outputs)
156+
mni_files = [
157+
p.name
158+
for p in pipe_ctx.output_dir.rglob("*.*")
159+
if "space-MNI152NLin6Asym" in p.name
160+
]
161+
assert len(mni_files) == 1
162+
assert "T1w" in mni_files[0]
163+
assert "desc-brain" in mni_files[0]
164+
150165

151166
# ---------------------------------------------------------------------------
152167
# Functional exports

0 commit comments

Comments
 (0)