Repository: nipy/nipype

Issue:
Meshfix interface inverting command parameters
### Summary
Hi,
While using the MeshFix interface, I received this error:
```shell
RuntimeError: Command:
meshfix /path/to/file.off -a 2.000000 0.200000 --fineTuneIn  4 --shells 2 -o file_fixed.off -q
Standard output:
Fixing asin tolerance to 3.491368e-02
Standard error:

ERROR- number of substeps must be > 0.
Return code: 255
```

### Actual behavior
As shown previously, the interface generated command leading to this error is:
```shell
meshfix /path/to/file.off -a 2.000000 0.200000 --fineTuneIn  4 --shells 2 -o file_fixed.off -q
```
And the error is pretty clear, the `--fineTuneIn` argument requires a distance **and** a substeps number. Those two parameters are actualy given in the code:
```python
finetune_wm = pe.Node(interface=mf.MeshFix(), name='finetune_wm')
finetune_wm.inputs.quiet_mode = True
finetune_wm.inputs.epsilon_angle = 2
finetune_wm.inputs.number_of_biggest_shells = 2
finetune_wm.inputs.finetuning_substeps = 4       # Set the substeps number
finetune_wm.inputs.finetuning_distance = 0.2     # Set the distance
finetune_wm.inputs.finetuning_inwards = True     # Set --fineTuneIn
```
And these parameters are also in the command but in a wrong order:
```shell
0.200000 --fineTuneIn  4
```

### Expected behavior
The correct order should be:
```shell
--fineTuneIn 0.200000  4
```
As writen in the doc:
> --fineTuneIn \<d\> \<n\> Used to fine-tune the minimal distance between surfaces 
> A minimal distance d is ensured, and reached in n substeps

And then the command should be:
```shell
meshfix /path/to/file.off -a 2.000000 --fineTuneIn 0.200000  4 --shells 2 -o file_fixed.off -q
```


Discussion:

Patch:
diff --git a/.zenodo.json b/.zenodo.json
index 1a7ba4632..2c92959ec 100644
--- a/.zenodo.json
+++ b/.zenodo.json
@@ -587,6 +587,11 @@
       "affiliation": "MIT, HMS",
       "name": "Ghosh, Satrajit",
       "orcid": "0000-0002-5312-6729"
+    },
+    {
+      "affiliation": "GIGA Institute",
+      "name": "Grignard, Martin",
+      "orcid": "0000-0001-5549-1861"
     }
   ],
   "keywords": [
diff --git a/nipype/interfaces/meshfix.py b/nipype/interfaces/meshfix.py
index 02a0db403..231f1fea9 100644
--- a/nipype/interfaces/meshfix.py
+++ b/nipype/interfaces/meshfix.py
@@ -70,8 +70,7 @@ class MeshFixInputSpec(CommandLineInputSpec):
 
     x_shift = traits.Int(
         argstr='--smooth %d',
-        desc=
-        "Shifts the coordinates of the vertices when saving. Output must be in FreeSurfer format"
+        desc="Shifts the coordinates of the vertices when saving. Output must be in FreeSurfer format"
     )
 
     # Cutting, decoupling, dilation
@@ -80,8 +79,7 @@ class MeshFixInputSpec(CommandLineInputSpec):
         desc="Remove triangles of 1st that are outside of the 2nd shell.")
     cut_inner = traits.Int(
         argstr='--cut-inner %d',
-        desc=
-        "Remove triangles of 1st that are inside of the 2nd shell. Dilate 2nd by N; Fill holes and keep only 1st afterwards."
+        desc="Remove triangles of 1st that are inside of the 2nd shell. Dilate 2nd by N; Fill holes and keep only 1st afterwards."
     )
     decouple_inin = traits.Int(
         argstr='--decouple-inin %d',
@@ -101,23 +99,28 @@ class MeshFixInputSpec(CommandLineInputSpec):
 
     finetuning_inwards = traits.Bool(
         argstr='--fineTuneIn ',
-        requires=['finetuning_distance', 'finetuning_substeps'])
+        requires=['finetuning_distance', 'finetuning_substeps'],
+        position=-3,
+        desc="Used to fine-tune the minimal distance between surfaces."
+    )
     finetuning_outwards = traits.Bool(
-        argstr='--fineTuneIn ',
+        argstr='--fineTuneOut ',
         requires=['finetuning_distance', 'finetuning_substeps'],
+        position=-3,
         xor=['finetuning_inwards'],
-        desc=
-        'Similar to finetuning_inwards, but ensures minimal distance in the other direction'
+        desc='Similar to finetuning_inwards, but ensures minimal distance in the other direction'
     )
     finetuning_distance = traits.Float(
         argstr='%f',
         requires=['finetuning_substeps'],
+        position=-2,
         desc="Used to fine-tune the minimal distance between surfaces."
         "A minimal distance d is ensured, and reached in n substeps. When using the surfaces for subsequent volume meshing by gmsh, this step prevent too flat tetrahedra2)"
     )
     finetuning_substeps = traits.Int(
         argstr='%d',
         requires=['finetuning_distance'],
+        position=-1,
         desc="Used to fine-tune the minimal distance between surfaces."
         "A minimal distance d is ensured, and reached in n substeps. When using the surfaces for subsequent volume meshing by gmsh, this step prevent too flat tetrahedra2)"
     )


Test patch:
diff --git a/nipype/interfaces/tests/test_auto_MeshFix.py b/nipype/interfaces/tests/test_auto_MeshFix.py
index 9f50145ba..48c689d2e 100644
--- a/nipype/interfaces/tests/test_auto_MeshFix.py
+++ b/nipype/interfaces/tests/test_auto_MeshFix.py
@@ -27,7 +27,7 @@ def test_MeshFix_inputs():
             requires=['finetuning_distance', 'finetuning_substeps'],
         ),
         finetuning_outwards=dict(
-            argstr='--fineTuneIn ',
+            argstr='--fineTuneOut ',
             requires=['finetuning_distance', 'finetuning_substeps'],
             xor=['finetuning_inwards'],
         ),
@@ -89,6 +89,8 @@ def test_MeshFix_inputs():
     for key, metadata in list(input_map.items()):
         for metakey, value in list(metadata.items()):
             assert getattr(inputs.traits()[key], metakey) == value
+
+
 def test_MeshFix_outputs():
     output_map = dict(mesh_file=dict(), )
     outputs = MeshFix.output_spec()