Skip to content

bidsmri2nidm: field-map capture + BIDS-inheritance sidecar metadata - #454

Merged
dbkeator merged 1 commit into
incf-nidash:masterfrom
dbkeator:master
Sep 14, 2026
Merged

dbkeator merged 1 commit into
incf-nidash:masterfrom
dbkeator:master

Conversation

@dbkeator

@dbkeator dbkeator commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

bidsmri2nidm: field-map capture + BIDS-inheritance sidecar metadata

Two related fixes to the legacy (prov-toolbox) bidsmri2nidm converter, rolled
up for the 4.5.5 maintenance release. Fixes #453.

1. Capture BIDS field-map scans (fb4ead7)

  • Build the BIDS layout with validate=False so files under fmap/ (which many
    real datasets lay out non-conformantly) are indexed instead of skipped.
  • Type field-map acquisitions with a nidm:FieldMap image-usage type
    (BIDS_Constants / Constants additions), including the ABIDE-II case where a
    field map is misplaced inside dwi/ — so it is no longer mislabeled
    DiffusionWeighted.
  • Emit the BIDS run index on anatomical scans (parity with the func/dwi branches).

2. BIDS-inheritance sidecar metadata via pybids get_metadata (7007f83, fixes #453)

bidsmri2nidm previously 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 and
rest-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:

  • New _scan_metadata(bids_layout, directory, file_tpl) →
    bids_layout.get_metadata(file_tpl.path), which implements the BIDS
    inheritance principle (dataset-root + session + scan-level JSON merged, for any
    suffix/task/session), with a direct-sidecar fallback.
  • All per-scan sidecar reads route through it; the hardcoded T1w.json /
    task-rest_bold.json root blocks are removed (now redundant).
  • Scan-level sidecar values correctly override dataset-root values.

(Also silences a py3.12 f-string E231 false positive on one pre-existing line
via # noqa.)

Testing

Full tests/experiment suite 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.

@dbkeator
dbkeator merged commit 7479355 into incf-nidash:master Sep 14, 2026
6 checks passed
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.

1 participant