safe_load_4dpet_nifti =========================================== .. py:function:: petpal.utils.image_io.safe_load_4dpet_nifti(filename: str) -> nibabel.nifti1.Nifti1Image Safely load a 4D PET NIfTI file. This function checks if the given file has a '.nii' or '.nii.gz' extension, then tries to load it as a NIfTI file using the nibabel library. If the file cannot be loaded, it raises an exception. :param filename: The path of the NIfTI file to be loaded. :type filename: str :returns: *Nifti1Image* -- The loaded NIfTI 4D PET image. :raises ValueError: If the file does not have a '.nii' or '.nii.gz' extension. :raises Exception: If an error occurred while loading the NIfTI file.