bidsmri2nidm: field-map capture + BIDS-inheritance sidecar metadata - #454
Merged
Merged
Conversation
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.
bidsmri2nidm: field-map capture + BIDS-inheritance sidecar metadata
Two related fixes to the legacy (prov-toolbox)
bidsmri2nidmconverter, rolledup for the 4.5.5 maintenance release. Fixes #453.
1. Capture BIDS field-map scans (
fb4ead7)validate=Falseso files underfmap/(which manyreal datasets lay out non-conformantly) are indexed instead of skipped.
nidm:FieldMapimage-usage type(
BIDS_Constants/Constantsadditions), including the ABIDE-II case where afield map is misplaced inside
dwi/— so it is no longer mislabeledDiffusionWeighted.2. BIDS-inheritance sidecar metadata via pybids
get_metadata(7007f83, fixes #453)bidsmri2nidmpreviously read scan metadata two ways: a per-scan sidecar read,plus a hardcoded descent into a dataset-root
T1w.json(anat) /task-rest_bold.json(func). That hardcoding only covered T1w anatomicals andrest-task functionals, and the two reads were applied additively with no
precedence (a scan-level value and a conflicting dataset-root value could both be
emitted).
@seanhatton flagged this in #453; that PR generalized the filename but read the
per-scan sidecar a second time (duplicate) and dropped the dataset-root
inheritance entirely. This fixes the root cause instead:
_scan_metadata(bids_layout, directory, file_tpl)→bids_layout.get_metadata(file_tpl.path), which implements the BIDSinheritance principle (dataset-root + session + scan-level JSON merged, for any
suffix/task/session), with a direct-sidecar fallback.
T1w.json/task-rest_bold.jsonroot blocks are removed (now redundant).(Also silences a py3.12 f-string
E231false positive on one pre-existing linevia
# noqa.)Testing
Full
tests/experimentsuite passes: 103 passed, 3 skipped.Thanks @seanhatton for catching the sidecar-metadata issue — this supersedes
#453, which I'll close in favor of this PR.
Note: this is a maintenance patch on the retiring 4.x line; the field-map term
here (
nidm:FieldMap) is refined in the forthcoming v5.0.0 LinkML release.