mrsiprep.tissue.fractions
Tissue fraction map helpers.
Functions
|
Copy T1w-space tissue-probability maps into the MRSIPrep derivatives tree. |
|
Locate pre-computed CAT12 GM/WM/CSF tissue-probability maps for a recording. |
|
Resample T1w-space tissue-probability maps onto the native MRSI grid. |
- mrsiprep.tissue.fractions.copy_tissue_to_derivatives(config, subject, session, tissue_t1)[source]
Copy T1w-space tissue-probability maps into the MRSIPrep derivatives tree.
Used with the
existingtissue backend to bring CAT12 maps (found whereverload_existing_cat12()located them) under MRSIPrep's ownconfounds/output naming, alongside SynthSeg+FAST-produced maps.- 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.tissue_t1 (dict[str, Path]) --
{label: path}of T1w-space tissue-probability maps to copy, keyed by tissue label (e.g."GM","WM","CSF").
- Returns:
{label: path}of the copied files' derivative paths. Recordings already copied are skipped (returned as-is) unlessconfig.overwrite_seg/config.overwriteis set.- Return type:
dict[str, Path]
- mrsiprep.tissue.fractions.load_existing_cat12(config, subject, session)[source]
Locate pre-computed CAT12 GM/WM/CSF tissue-probability maps for a recording.
Used by the
existingtissue_backend, which reuses tissue segmentation already produced outside MRSIPrep instead of running SynthSeg+FAST.- 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.
- Returns:
{"GM": path, "WM": path, "CSF": path}, the CAT12 p1/p2/p3 probability-segmentation files found in the BIDS layout.- Raises:
FileNotFoundError -- If any of the three maps is missing.
- Return type:
dict[str, Path]
- mrsiprep.tissue.fractions.resample_tissue_to_mrsi(config, subject, session, tissue_t1, mrsi_reference, t1_to_mrsi_transforms)[source]
Resample T1w-space tissue-probability maps onto the native MRSI grid.
Plain linear-interpolation resample, applying the (inverse) MRSI-to-T1w transform to bring each map back onto
mrsi_reference's grid for use in partial-volume correction. For the MIDAS-mode PSF-aware alternative (which convolves with the MRSI spatial response before resampling instead of a bare linear interpolation), seemrsiprep.tissue.psf.resample_tissue_to_mrsi_psf().- 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.tissue_t1 (dict[str, Path]) --
{label: path}of T1w-space tissue-probability maps to resample.mrsi_reference (Path) -- MRSI reference image defining the target grid.
t1_to_mrsi_transforms (list[Path]) -- Ordered ANTs/FSL transform file(s) mapping T1w space to MRSI space (i.e. the inverse of the MRSI-to-T1w registration).
- Returns:
{label: path}of the resampled, MRSI-grid tissue-probability maps. Recordings already resampled are skipped (returned as-is) unlessconfig.overwrite_seg/config.overwriteis set.- Return type:
dict[str, Path]