Repository: nipy/nipype

Issue:
LaplacianThickness() trait error path like object
### Summary

LaplacianThickness() trait an error The 'output_image' trait of a LaplacianThicknessOutputSpec instance must be a pathlike object or string representing an existing file, but a value of '/input/wc2sub-1_struct-Flair_thickness.nii' <class 'str'> was specified.

### Actual behavior
doesn't the output thickness file if called with from nipype.interfaces.ants import LaplacianThickness, with an error The 'output_image' trait of a LaplacianThicknessOutputSpec instance must be a pathlike object or string representing an existing file, but a value of '/input/wc2sub-1_struct-Flair_thickness.nii' <class 'str'> was specified.

### Expected behavior
produces thickness file. If it called with function in shell, not in python:
LaplacianThickness wc2sub-1_struct-Flair.nii wc1sub-1_struct-Flair.nii thickness_sub-1_struct-Flair.nii,
output file successfully produced.

### How to replicate the behavior

### Script/Workflow details

cort_thick = LaplacianThickness()
cort_thick.inputs.input_wm = 'wc2sub-1_struct-Flair.nii'
cort_thick.inputs.input_gm = 'wc1sub-1_struct-Flair.nii'
cort_thick.inputs.output_image = 'thickness_sub-1_struct-Flair.nii'
cort_thick.run()

print(cort_thick.cmdline)
#cort_thick.inputs.output_image = 'thickness_sub-1_struct-Flair.nii'
#print(cort_thick.cmdline)

Please put URL to code or code here (if not too long).

### Platform details:

<!-- Please run the following code from your shell and place the output between the triple ticks, below.
python -c "import nipype; from pprint import pprint; pprint(nipype.get_info())"
-->

```
{'commit_hash': '<not found>',
 'commit_source': '(none found)',
 'networkx_version': '2.6.3',
 'nibabel_version': '3.2.1',
 'nipype_version': '1.6.1',
 'numpy_version': '1.21.2',
 'pkg_path': '/src/nipype/nipype',
 'scipy_version': '1.7.1',
 'sys_executable': '/opt/miniconda-latest/envs/neuro/bin/python3.8',
 'sys_platform': 'linux',
 'sys_version': '3.8.12 | packaged by conda-forge | (default, Sep 29 2021, '
                '19:52:28) \n'
                '[GCC 9.4.0]',
 'traits_version': '6.2.0'}
```

### Execution environment

Choose one
- Container [Tag: latest]




Discussion:
Looks like we need to change that parameter from File to Str. Would you mind submitting a PR?

Resolving patch:
diff --git a/nipype/interfaces/ants/segmentation.py b/nipype/interfaces/ants/segmentation.py
--- a/nipype/interfaces/ants/segmentation.py
+++ b/nipype/interfaces/ants/segmentation.py
@@ -268,7 +268,7 @@ class LaplacianThicknessInputSpec(ANTSCommandInputSpec):
         desc="gray matter segmentation image",
         position=2,
     )
-    output_image = File(
+    output_image = traits.Str(
         desc="name of output file",
         argstr="%s",
         position=3,


Test patch:
diff --git a/nipype/interfaces/ants/tests/test_auto_LaplacianThickness.py b/nipype/interfaces/ants/tests/test_auto_LaplacianThickness.py
--- a/nipype/interfaces/ants/tests/test_auto_LaplacianThickness.py
+++ b/nipype/interfaces/ants/tests/test_auto_LaplacianThickness.py
@@ -36,7 +36,6 @@ def test_LaplacianThickness_inputs():
         ),
         output_image=dict(
             argstr="%s",
-            extensions=None,
             hash_files=False,
             keep_extension=True,
             name_source=["input_wm"],