populse / capsul

Collaborative Analysis Platform : Simple, Unifying, Lean
Other
7 stars 14 forks source link

Nipype's mutually exclusive parameters bug #289

Closed servoz closed 11 months ago

servoz commented 11 months ago

We seem to have a problem with nipype's concept of mutually exclusive.

Nipype uses two trait options: mandatory and xor to determine whether a parameter should be defined (different from Undefined). The trait of a parameter_1 must have a defined value if it has mandatory = True. But it doesn't stop there. There's also the xor option which, if defined, is a list of parameters that cannot exist concomitantly with parameter_1.

For example, for spm's Normalize12 process, the nipype traits for the following input parameters have these options:

The issue is that Process.get_missing_mandatory_parameters() doesn't take xor into account. It only looks if the parameter is mandatory and has a value. This produces false positives in the case of mutually exclusive parameters...

In mia_processes we can handle this upstream, but when it's a process coming directly from nipype, if, for example in the case above, image_to_align = Apath/to/data.nii' and deformation_file = Undefined, Process.get_missing_mandatory_parameters() return [deformation_file] whereas since the parameters are mutually exclusive, there's no missing parameter here ...

For a complete overview we actually have two issues. 1- The false positive generated in capsul which prevents calculation from starting in Mia

2- The raising of an exception by nipype if two mutually exclusive parameters have a value (in the example above image_to_align and deformation_file have a value) which crash Mia.

The two are linked with the concept of Nipype's mutually exclusive, but this ticket is only concerning 1- (I will see 2- later).

I will propose a fix for 1-

servoz commented 11 months ago

The fix is now merged. We can now close this ticket.