mrsiprep.tissue.psf

MIDAS-style PSF-based tissue-fraction convolution.

Replicates the tissue-contribution image formation of Maudsley et al. 2006 (Fig. 3): the high-resolution tissue segmentation is convolved with the MRSI 3D spatial response function (a k-space-truncated, apodized sinc) before being resampled to the MRSI grid, so that partial-volume fractions reflect the true (wide, sinc-like) MRSI voxel response rather than a plain linear-interpolation resample of a near-delta-response probability map.

This is the MIDAS-mode-only path; the existing mrsiprep.tissue.fractions.resample_tissue_to_mrsi (plain linear resample) is untouched and remains in use for mni-norm/parc-con modes.

Functions

convolve_with_psf(data, kernel)

Convolve data with kernel, normalized against edge falloff.

convolve_with_psf_separable(data, axes)

Edge-normalized separable convolution: apply the three 1D PSF axes in sequence.

hamming_sinc_psf_kernel(voxel_mm, ...[, ...])

Separable 3D Hamming-apodized sinc kernel for the MRSI spatial response.

psf_axes(voxel_mm, grid_spacing_mm[, alpha, ...])

The three separable 1D Hamming-sinc axes of the MRSI PSF (per axis).

resample_tissue_to_mrsi_psf(config, subject, ...)

MIDAS-mode sibling of resample_tissue_to_mrsi (MIDAS Fig.

mrsiprep.tissue.psf.convolve_with_psf(data, kernel)[source]

Convolve data with kernel, normalized against edge falloff.

Convolving against implicit zero padding attenuates voxels near the image boundary; dividing by the convolution of an all-ones support map restores them (same edge-handling idea as the biharmonic smoothing in mrsi/filtering.py).

Parameters:
  • data (ndarray)

  • kernel (ndarray)

Return type:

ndarray

mrsiprep.tissue.psf.convolve_with_psf_separable(data, axes)[source]

Edge-normalized separable convolution: apply the three 1D PSF axes in sequence. Equivalent to convolve_with_psf with the outer-product kernel but far faster on large volumes (O(N*K) vs O(N*K^3)).

Parameters:
  • data (ndarray)

  • axes (list[ndarray])

Return type:

ndarray

mrsiprep.tissue.psf.hamming_sinc_psf_kernel(voxel_mm, grid_spacing_mm, alpha=0.54, truncation_radius=3.0)[source]

Separable 3D Hamming-apodized sinc kernel for the MRSI spatial response.

voxel_mm is the MRSI voxel size (the width of the MRSI spatial response, i.e. the location of the first sinc null) and grid_spacing_mm the spacing of the grid the kernel is applied on -- the high-resolution T1w/ tissue grid, so voxel_mm / grid_spacing_mm is the null spacing in grid voxels. truncation_radius sets the support in units of that null spacing. Returned kernel is normalized to sum 1.

Parameters:
  • voxel_mm (tuple[float, float, float])

  • grid_spacing_mm (tuple[float, float, float])

  • alpha (float)

  • truncation_radius (float)

Return type:

ndarray

mrsiprep.tissue.psf.psf_axes(voxel_mm, grid_spacing_mm, alpha=0.54, truncation_radius=3.0)[source]

The three separable 1D Hamming-sinc axes of the MRSI PSF (per axis).

The full 3D kernel is their outer product; keeping them separable lets convolve_with_psf_separable apply three cheap 1D convolutions instead of one dense O(K^3) 3D convolution.

Parameters:
  • voxel_mm (tuple[float, float, float])

  • grid_spacing_mm (tuple[float, float, float])

  • alpha (float)

  • truncation_radius (float)

Return type:

list[ndarray]

mrsiprep.tissue.psf.resample_tissue_to_mrsi_psf(config, subject, session, tissue_t1, mrsi_reference, t1_to_mrsi_transforms, alpha=0.54, truncation_radius=3.0)[source]

MIDAS-mode sibling of resample_tissue_to_mrsi (MIDAS Fig. 3).

Convolves each high-resolution T1w-space tissue map with the MRSI spatial response function (a Hamming-apodized sinc whose first null sits at the MRSI voxel width) before resampling to the MRSI grid, so partial-volume fractions reflect the wide MRSI voxel response. Convolving in the T1w grid (where the ~5 mm MRSI PSF spans several 1 mm voxels) is essential: doing it after downsampling to the coarse MRSI grid would sample the sinc on its own nulls and degenerate to a no-op. Outputs carry a desc-psf entity so they don't collide with, or reuse a stale cache from, the plain linear-resample fractions.

Parameters:
  • subject (str)

  • session (str | None)

  • tissue_t1 (dict[str, Path])

  • mrsi_reference (Path)

  • t1_to_mrsi_transforms (list[Path])

  • alpha (float)

  • truncation_radius (float)

Return type:

dict[str, Path]