Repository: nipy/nipype

Issue:
AFNI CatMatvec: Caching fails and output file undefined
### Summary
AFNI CatMatvec  interface caching fails and output file is undefined
### How to replicate the behavior
```Python
from nipype.interfaces import afni
from nipype.caching import Memory
memory = Memory('/tmp/test_catmatvec/')
catmatvec = memory.cache(afni.CatMatvec)
out_catmatvec = catmatvec(in_file=[('/tmp/test_caching/allineate_affine.aff12.1D', 'ONELINE')], out_file='/tmp/test_catmatvec2.aff12.1D')
print(out_catmatvec.outputs)
```
gives `out_file = <undefined>`. Moreover, when launching the same code twice the computations are restarted
### Platform details:

{'nibabel_version': '2.2.1', 'sys_executable': '/home/salma/anaconda2/bin/python', 'networkx_version': '2.0', 'numpy_version': '1.13.3', 'sys_platform': 'linux2', 'sys_version': '2.7.14 |Anaconda custom (64-bit)| (default, Oct 16 2017, 17:29:19) \n[GCC 7.2.0]', 'commit_source': 'repository', 'commit_hash': 'e446466', 'pkg_path': '/home/salma/CODE/nipype/nipype', 'nipype_version': '1.0.3-dev+ge446466', 'traits_version': '4.6.0', 'scipy_version': '1.0.0'}
1.0.3-dev+ge446466


Discussion:

Patch:
diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py
index 9f306c7b8..cb01ae4a2 100644
--- a/nipype/interfaces/afni/utils.py
+++ b/nipype/interfaces/afni/utils.py
@@ -564,8 +564,11 @@ class CatMatvecInputSpec(AFNICommandInputSpec):
         argstr="%s",
         position=-2)
     out_file = File(
-        desc="File to write concattenated matvecs to",
         argstr=" > %s",
+        name_template='%s_cat.aff12.1D',
+        name_source='in_file',
+        keep_extension=False,
+        desc="File to write concattenated matvecs to",
         position=-1,
         mandatory=True)
     matrix = traits.Bool(


Test patch:
diff --git a/nipype/interfaces/afni/tests/test_auto_CatMatvec.py b/nipype/interfaces/afni/tests/test_auto_CatMatvec.py
index dc1c981bb..df0ac34e0 100644
--- a/nipype/interfaces/afni/tests/test_auto_CatMatvec.py
+++ b/nipype/interfaces/afni/tests/test_auto_CatMatvec.py
@@ -38,7 +38,10 @@ def test_CatMatvec_inputs():
         ),
         out_file=dict(
             argstr=' > %s',
+            keep_extension=False,
             mandatory=True,
+            name_source='in_file',
+            name_template='%s_cat.aff12.1D',
             position=-1,
         ),
         outputtype=dict(),