I did not encounter this problem when testing the same script on one of the atlas files, but it fails on my MRI volumes. While I understand there might be something wrong with my data, it would be very helpful if the script would raise a more informative error and tell me what the problem is. I tried tweaking the header, even replacing it entirely with the header from one of the template volumes (while keeping dim, pixdim, srow_* and affine matrix data), with no changes.
[mas_masking_batch] run label fusion locally for target: O.nii.gz ...
target_dir=/media/Olowoo/theoldstuff/DMM
target_id=O.nii.gz
result_dir=/media/Olowoo/theoldstuff/test
atlas_dir=/media/Olowoo/validation/atlases
atlas_name=atlases
[mas_masking_fusion] prepare 4D mask file /media/Olowoo/theoldstuff/test/mask/atlases/O.nii.gz.4D.nii.gz for label fusion ...
** ERROR (nifti_image_read): failed to find header file for '/media/Olowoo/theoldstuff/test/mask/atlases/O.nii.gz.mask.A0.affine.nii.gz'
* Error when reading the input image
[check_image_file] cannot find file (/media/Olowoo/theoldstuff/test/mask/O.nii.gz.mask.atlases.nii.gz)
[mas_masking_fusion] fuse mapped mask from atlases for O.nii.gz
** ERROR (nifti_image_read): failed to find header file for '/media/Olowoo/theoldstuff/test/mask/atlases/O.nii.gz.4D.nii.gz'
* Error when reading the Label image: /media/Olowoo/theoldstuff/test/mask/atlases/O.nii.gz.4D.nii.gz
[check_image_file] cannot find file (/media/Olowoo/theoldstuff/test/mask/O.nii.gz.mask.atlases.nii.gz)
[mas_masking_fusion] (O.nii.gz) failed to generate mask file: /media/Olowoo/theoldstuff/test/mask/O.nii.gz.mask.atlases.nii.gz, skip quickcheck ...