MriImageLoader#

class polpo.preprocessing.mri.MriImageLoader(filename=None, as_nib=False, return_affine=False)[source]#

Bases: PreprocessingStep

Load image from .nii file.

Parameters:
  • filename (str) – File to load.

  • as_nib (bool) – Whether to return the nibabel object.

  • return_affine (bool) – Whether to return the affine transformation. Ignore if as_nib is True.

apply(filename=None)[source]#

Apply step.

Parameters:

filename (str) – File to load.

Returns:

  • img (nibabel.nifti1.Nifti1Image) – If as_nib is True.

  • img_data (np.array) – If as_nib is False.

  • affine (nibabel.nifti1.Nifti1Image) – If as_nib is False and affine is True.