def get_case_id_from_file(file_name: str, remove_modality: bool = True) -> str:
    """
    Cut of ".nii.gz" from file name

    Args:
        file_name (str): name of file with .nii.gz ending
        remove_modality (bool): remove the modality string from the filename

    Returns:
        str: name of file without ending
    """
    file_name = file_name.split('.')[0]
    if remove_modality:
        file_name = file_name[:-5]
    return file_name