def _get_mri_header(fname):
    import nibabel as nib
    img = nib.load(fname)
    try:
        return img.header
    except AttributeError:  # old nibabel
        return img.get_header()
Get MRI header using nibabel
dataset/ETHPy150Open mne-tools/mne-python/mne/source_space.py/_get_mri_header