Open htwangtw opened 1 year ago
Obviously this would improve UX and is in the scope of Nilearn. It's not very clear how much additional code you had mind, should not be much I guess.
I haven't started working on the code side yet, but can work on a PR and use that as a base of the discussion.
Is there an existing issue for this?
Describe your proposed enhancement in detail.
I encountered this when creating a group epi mask for a dataset, all outputs are in native epi space from fMRIPrep.
Currently the function would raise an error when detecting a mask with unmatched affine/shape from the reference, but no further details.
This is useful, but I will need to almost duplicate the code of this function if they want to catch which image is causing the problem, or find out what's the reference/problematic affine/shape for further diagnosis.
I consider to refactor the code, mostly to separate the sanity check from the mask merging function in the current function. We can just raise the error with more details, and that will not change the input/ouput spec of the current function.
Benefits to the change
Clearer issue with what's going on when encountering an shape / affine mismatch.
Pseudocode for the new behavior, if applicable
No response