mrsiprep.workflows.mrsi
MRSI preprocessing workflow.
Functions
|
Preprocess one recording's native-space MRSI maps. |
Classes
|
Native-space MRSI derivatives produced by |
- class mrsiprep.workflows.mrsi.MRSIResult(raw_maps, preproc_maps, corrected_maps, crlb_maps, snr_map, linewidth_map, water_map, brainmask, reference, qcmasks, qc_summary, t1_correction_provenance=None)[source]
Bases:
objectNative-space MRSI derivatives produced by
run_mrsi_workflow().All paths are in MRSI-native space; per-metabolite maps are keyed by metabolite name (e.g.
"CrPCr", matching--metabolites/--ref-met).- Variables:
raw_maps -- Metabolite signal maps as copied into the derivatives tree, unmodified from
derivatives/mrsi-orig/.preproc_maps -- Metabolite maps after spike detection and biharmonic repair (see
mrsiprep.mrsi.filtering.filter_metabolite_maps()).corrected_maps -- Identical to
preproc_mapsunlessconfig.t1_correction == "literature", in which case this holds the T1-saturation-corrected maps (seemrsiprep.mrsi.t1_correction.apply_t1_correction()). Partial volume correction happens later (seemrsiprep.mrsi.pvc.run_pvc()), not in this workflow, and always consumescorrected_mapsas its input.t1_correction_provenance -- Per-metabolite T1-correction summary rows (TR, flip angle, T1, factor, source, warnings), or
Nonewhenconfig.t1_correction == "none".crlb_maps -- Per-metabolite Cramér-Rao lower bound maps, copied through unchanged from the raw inputs.
snr_map -- Whole-brain signal-to-noise-ratio map, if the input BIDS layout provided one.
linewidth_map -- Whole-brain linewidth/FWHM map, if provided.
water_map -- Water-reference image, if provided (used for coil combination / normalization upstream of mrsiprep, not recomputed here).
brainmask -- MRSI-native brainmask, either taken from the inputs or derived when missing (see
mrsiprep.mrsi.masks.ensure_brainmask()).reference -- The reference-metabolite image used to drive MRSI→T1w registration (
config.ref_met, defaultCrPCr).qcmasks -- Per-metabolite voxel-quality masks (SNR/CRLB/FWHM thresholds applied), keyed the same way as
preproc_maps.qc_summary -- Path to the per-recording QC summary table produced alongside
qcmasks.
- Parameters:
raw_maps (dict[str, Path])
preproc_maps (dict[str, Path])
corrected_maps (dict[str, Path])
crlb_maps (dict[str, Path])
snr_map (Path | None)
linewidth_map (Path | None)
water_map (Path | None)
brainmask (Path)
reference (Path)
qcmasks (dict[str, Path])
qc_summary (Path)
t1_correction_provenance (list[dict] | None)
- brainmask: Path
- corrected_maps: dict[str, Path]
- crlb_maps: dict[str, Path]
- linewidth_map: Path | None
- preproc_maps: dict[str, Path]
- qc_summary: Path
- qcmasks: dict[str, Path]
- raw_maps: dict[str, Path]
- reference: Path
- snr_map: Path | None
- t1_correction_provenance: list[dict] | None = None
- water_map: Path | None
- mrsiprep.workflows.mrsi.run_mrsi_workflow(config, subject, session, inputs)[source]
Preprocess one recording's native-space MRSI maps.
Copies raw inputs into the derivatives tree, ensures a brainmask exists (deriving one from the water/metabolite maps if the input layout didn't provide one), filters metabolite maps (spike detection and biharmonic repair), builds the reference-metabolite image used to drive registration, and computes voxel-level quality masks from the SNR/CRLB/FWHM thresholds in
config.- Parameters:
config -- Run-wide
mrsiprep.config.settings.MRSIPrepConfig.subject (str) -- BIDS subject label, without the
sub-prefix.session (str | None) -- BIDS session label without the
ses-prefix, orNonefor session-less datasets.inputs (MRSIInputs) -- The recording's raw MRSI inputs as discovered by
mrsiprep.io.loaders.load_mrsi_inputs()(metabolite/CRLB maps, SNR/linewidth/water maps, brainmask -- any of which may beNoneexceptmetabolite_maps).
- Returns:
MRSIResultwith all derivatives written toconfig.derivative_dirand referenced by path.- Return type: