gastropy.neuro.fmri.load_bold

Contents

gastropy.neuro.fmri.load_bold#

gastropy.neuro.fmri.load_bold(bold_path, mask_path)[source]#

Load fMRIPrep BOLD and brain mask as a masked 2D array.

Convenience wrapper around nibabel that loads a preprocessed BOLD NIfTI and brain mask, applies the mask, and returns the data ready for confound regression and phase extraction.

Parameters:
  • bold_path (str or Path) – Path to the preprocessed BOLD NIfTI file (e.g., *_desc-preproc_bold.nii.gz).

  • mask_path (str or Path) – Path to the brain mask NIfTI file (e.g., *_desc-brain_mask.nii.gz).

Returns:

result – Dictionary with keys:

  • bold_2d : np.ndarray, shape (n_voxels, n_volumes)

  • mask : np.ndarray, boolean 3D array

  • affine : np.ndarray, 4x4 affine matrix

  • vol_shape : tuple, spatial dimensions (x, y, z)

  • n_volumes : int

Return type:

dict