mrsiprep.workflows.tissue

Tissue workflow.

Functions

run_tissue_workflow(config, subject, ...[, ...])

Segment tissue class probabilities in T1w space and resample to MRSI space.

segment_t1_fuzzy_cmeans(config, subject, ...)

MIDAS-mode tissue segmentation: fuzzy c-means on a brain-extracted T1w.

Classes

TissueResult(t1, mrsi)

GM/WM/CSF probability maps in T1w and MRSI space, from run_tissue_workflow().

class mrsiprep.workflows.tissue.TissueResult(t1, mrsi)[source]

Bases: object

GM/WM/CSF probability maps in T1w and MRSI space, from run_tissue_workflow().

Variables:
  • t1 -- T1w-space tissue probability maps, keyed by label ("GM", "WM", "CSF").

  • mrsi -- The same tissue classes, resampled onto the MRSI grid.

Parameters:
  • t1 (dict[str, Path])

  • mrsi (dict[str, Path])

mrsi: dict[str, Path]
t1: dict[str, Path]
mrsiprep.workflows.tissue.run_tissue_workflow(config, subject, session, t1_path, brain_mask, mrsi_reference, t1_to_mrsi_transforms, precomputed_tissue_t1=None)[source]

Segment tissue class probabilities in T1w space and resample to MRSI space.

T1w-space segmentation is selected via config.tissue_backend: "synthseg-fast" runs SynthSeg + FSL FAST, "existing" reuses a precomputed CAT12 segmentation found in the BIDS layout. Resampling to MRSI space uses PSF convolution (matching the MRSI acquisition's point-spread function) when config.processing_mode == "midas" -- following Maudsley et al. 2006 -- and plain transform-based resampling otherwise.

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, or None for session-less datasets.

  • t1_path (Path) -- Skull-stripped T1w image to segment (ignored if precomputed_tissue_t1 is given).

  • brain_mask (Path | None) -- T1w-space brain mask; may be None depending on backend.

  • mrsi_reference (Path) -- Reference-metabolite image defining the target MRSI grid for resampling.

  • t1_to_mrsi_transforms (list[Path]) -- Inverse (T1w→MRSI) transform chain, as produced by mrsiprep.workflows.registration.RegistrationResult.mrsi_to_t1's inverse.

  • precomputed_tissue_t1 (dict[str, Path] | None) -- If given, skip T1w-space segmentation entirely and resample these maps directly -- used when a subject-template longitudinal run already computed them once.

Returns:

TissueResult with T1w- and MRSI-space GM/WM/CSF maps.

Raises:

ValueError -- If config.tissue_backend isn't one of the supported values.

Return type:

TissueResult

mrsiprep.workflows.tissue.segment_t1_fuzzy_cmeans(config, subject, session, t1_path, brain_mask_path)[source]

MIDAS-mode tissue segmentation: fuzzy c-means on a brain-extracted T1w.

Writes GM/WM/CSF probseg NIfTIs using the same anat_derivative naming as segment_t1_synthseg_fast, so downstream consumers need no changes.

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, or None for session-less datasets.

  • t1_path (Path) -- Skull-stripped T1w image to segment.

  • brain_mask_path (Path) -- Brain mask matching t1_path, thresholded at 0.5 to select voxels the c-means clustering runs over.

Returns:

Dict of {"GM": path, "WM": path, "CSF": path}, skipped (returned as-is) if all three already exist and neither config.overwrite_seg nor config.overwrite is set.

Return type:

dict[str, Path]