from_nifti

Import in python using from mcutils.scripts.to_dataframe import from_nifti

mcutils.scripts.to_dataframe.from_nifti(img: Union[str, nibabel.nifti1.Nifti1Image, numpy.ndarray], mask: Union[None, str, nibabel.nifti1.Nifti1Image, numpy.ndarray] = None, name='nifti') → pandas.core.frame.DataFrame[source]

Converts a NIFTI image into a pandas dataframe

Parameters
  • img – NIFTI image

  • mask – masks which voxels to actually include (default: any non-zero voxels)

  • name – column name

Returns

pandas dataframe with unmasked voxels