Filter MNI-registered brains out of longitudinal template discovery#308
Merged
Conversation
discover_template_inputs picked up both the native-space and the MNI-registered desc-brain T1w that cross-sectional anat writes per session, doubling the inputs and producing duplicate LTA filenames in the mri_robust_template invocation. Latent because existing unit tests fed only native-space rows. Surfaced by the ds000114 fixture infra in PR #307. Adds an explicit regression test covering the MNI variant.
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.
Summary
rbc.bids.longitudinal.template.discover_template_inputswas filtering ondesc == "brain"+suffix == "T1w"but not onspace. Cross-sectional anat writes both a native-space and an MNI-registereddesc-brainT1w per session, so on a real two-session derivatives tree it returned 4 inputs for 2 sessions with duplicate LTA filenames, breaking themri_robust_templatecall.Fix is one filter clause:
pl.col("space").is_null(). Adds a regression unit test that includes the MNI-registered row.Context
tests/unit/bids/test_longitudinal_template.pyonly fed native-space rows into the fake DataFrame.Test plan
uv run pytest tests/unit/bids/test_longitudinal_template.py -v— 6 passed including the newtest_excludes_mni_registered_brains.uv run ruff check/format --check/mypyclean.test_fullafter Add ds000114 fixture infrastructure for longitudinal tests #307 rebases will exercise the real two-session path on ds000114.