mrsiprep.io.mrsinmrs

MRSinMRS (Lin et al. 2021, PMID 33559967) sequence-parameter reporting.

Reads an optional dataset-level mrsinmrs.json at the BIDS root, carrying MRSI acquisition/hardware/reconstruction parameters so they can be surfaced in each subject/session's QC report for reproducibility and transparency. This file is never required for processing -- its absence just means the report's MRSinMRS section is omitted.

Functions

load_mrsinmrs(bids_dir)

Parse <bids_dir>/mrsinmrs.json if present.

resolve_mrsinmrs(parsed, subject, session)

Merge CommonMetadata with the matching Recordings entry.

mrsiprep.io.mrsinmrs.load_mrsinmrs(bids_dir)[source]

Parse <bids_dir>/mrsinmrs.json if present.

Returns None if the file does not exist (this is the expected default case). Raises ValueError on a malformed file, matching load_bids_filters()'s "loud on error, silent only when absent" style.

Parameters:

bids_dir (str | Path)

Return type:

dict | None

mrsiprep.io.mrsinmrs.resolve_mrsinmrs(parsed, subject, session)[source]

Merge CommonMetadata with the matching Recordings entry.

Recording match order: exact subject+session, then subject-only (a Recordings entry with no "ses" key applies to all of that subject's sessions). Returns None only if parsed itself is None or the file has no CommonMetadata and no matching Recordings entry.

Parameters:
  • parsed (dict | None)

  • subject (str)

  • session (str | None)

Return type:

dict | None