nibabel.filebasedimages.ImageFileError: Cannot work out file type of

i am getting this error when i am applying medical torch code , i know my data is tif and gif format , and i think this part " mt_datasets.SegmentationPair2D" deals just with “nii” format what i can change to make it work with other fromat than “nii”

ROOT_DIR_GMCHALLENGE = r'C:\Users~~~\eyedata\train'
mri_input_filename = os.path.join(ROOT_DIR_GMCHALLENGE,
                                          'img')
mri_gt_filename = os.path.join(ROOT_DIR_GMCHALLENGE,
                                       'label')

pair = mt_datasets.SegmentationPair2D(mri_input_filename, mri_gt_filename)
slice_pair = pair.get_pair_slice(0)
input_slice = slice_pair["input"]
gt_slice = slice_pair["gt"]