mrsiprep.workflows.connectivity

Metabolic profile and connectivity workflow.

Functions

run_connectivity_workflow(config, subject, ...)

Estimate perturbation-augmented regional metabolic profiles, then optionally correlate them into a metabolic connectivity matrix.

mrsiprep.workflows.connectivity.run_connectivity_workflow(config, subject, session, regional_table, parcels, metabolite_maps, crlb_maps, brainmask, gm_fraction_path=None)[source]

Estimate perturbation-augmented regional metabolic profiles, then optionally correlate them into a metabolic connectivity matrix.

Profile estimation (CRLB-scaled Monte Carlo uncertainty propagation, Instrella & Juchem 2024) always runs -- it is the standard, unconditional regional-derivative output of parc-con mode, independent of --write-connectivity. Connectivity-matrix construction is the optional add-on: it reuses the already-computed profiles rather than recomputing them, and only runs when config.write_connectivity is set.

Parameters:
  • config -- Run-wide mrsiprep.config.settings.MRSIPrepConfig.

  • subject -- BIDS subject label, without the sub- prefix.

  • session -- BIDS session label without the ses- prefix, or None for session-less datasets.

  • regional_table -- Path to the per-parcel regional metabolite TSV, as produced by mrsiprep.parcellation.extraction.extract_regional_metabolites().

  • parcels -- Backend-specific parcellation result (supplies atlas_name, atlas_mrsi, and scale).

  • metabolite_maps -- MRSI-space metabolite maps used to compute perturbation-based profiles.

  • crlb_maps -- Matching per-metabolite CRLB maps.

  • brainmask -- MRSI-space brainmask restricting which voxels contribute to the profiles.

  • gm_fraction_path -- Optional gray-matter fraction map, used to weight profiles by GM content when given.

Returns:

Dict with a "profiles" entry (path to the exported metabolic-profile .npz, always present) plus "matrix_npz", "nodes", and "edges" entries when --write-connectivity was also set.