def METHOD_NAME(self, nii: nib.Nifti1Image) -> nib.Nifti1Image:
    """
    Checks the NIfTI header datatype and converts the data to the matching
    numpy dtype.
    Parameters
    ----------
    nii : nib.Nifti1Image
        Input image
    Returns
    -------
    nib.Nifti1Image
        Converted input image
    """
    header = nii.header.copy()
    datatype = int(header["datatype"])
    self._warn_suspicious_dtype(datatype)
    try:
        dtype = NUMPY_DTYPE[datatype]
    except KeyError:
        return nii
    else:
        header.set_data_dtype(dtype)
        converted = np.asanyarray(nii.dataobj, dtype=dtype)
        return nib.Nifti1Image(converted, nii.affine, header)