Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Afni suffix #367

Merged
merged 5 commits into from

2 participants

@bpinsard
Owner

Oups, sorry It seems that I messed up things about filename generation.
Here is the fix.

@satra
Owner

does CalcInputSpec have to be derived from CommandLineInputSpec for a reason?

@bpinsard
Owner

I cannot see any reason then changed it. Thanks for your help in cleaning/standardizing this code.

@satra satra merged commit 36bbd57 into nipy:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 26, 2012
  1. fixing what I messed up

    bpinsard authored
  2. test/fixs

    bpinsard authored
  3. Merge branch 'master' into afni_suffix

    bpinsard authored
    * master:
  4. this is the nth time that I change this...

    bpinsard authored
  5. AFNITraitedSpec for Calc

    bpinsard authored
This page is out of date. Refresh to see the latest.
View
145 nipype/interfaces/afni/preprocess.py
@@ -167,10 +167,11 @@ def _gen_filename(self, name):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.in_file,
suffix = self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
@@ -309,10 +310,11 @@ def _gen_filename(self, name):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
- outputs['out_file'] = self._gen_fname(
- self.inputs.in_file, suffix=self.inputs.suffix)
+ if not isdefined(self.inputs.out_file):
+ outputs['out_file'] = self._gen_fname(self.inputs.in_file,
+ suffix = self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
@@ -369,10 +371,11 @@ def _gen_filename(self, name):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
- outputs['out_file'] = self._gen_fname(
- self.inputs.in_file, suffix=self.inputs.suffix)
+ if not isdefined(self.inputs.out_file):
+ outputs['out_file'] = self._gen_fname(self.inputs.in_file,
+ suffix = self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
@@ -428,10 +431,11 @@ def _gen_filename(self, name):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
- outputs['out_file'] = self._gen_fname(
- self.inputs.in_file, suffix=self.inputs.suffix)
+ if not isdefined(self.inputs.out_file):
+ outputs['out_file'] = self._gen_fname(self.inputs.in_file,
+ suffix = self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
@@ -485,10 +489,11 @@ def _gen_filename(self, name):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
- outputs['out_file'] = self._gen_fname(
- self.inputs.in_file, suffix=self.inputs.suffix)
+ if not isdefined(self.inputs.out_file):
+ outputs['out_file'] = self._gen_fname(self.inputs.in_file,
+ suffix = self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
@@ -542,10 +547,11 @@ def _gen_filename(self, name):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
- outputs['out_file'] = self._gen_fname(
- self.inputs.in_file, suffix=self.inputs.suffix)
+ if not isdefined(self.inputs.out_file):
+ outputs['out_file'] = self._gen_fname(self.inputs.in_file,
+ suffix = self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
@@ -621,15 +627,17 @@ def _gen_filename(self, name):
def _list_outputs(self):
outputs = self.output_spec().get()
-
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(
self.inputs.in_file, suffix=self.inputs.mask_suffix)
- outputs['brain_file'] = os.path.abspath(self.inputs.apply_mask)
- if not isdefined(outputs['brain_file']):
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
+
+ if not isdefined(self.inputs.apply_mask):
outputs['brain_file'] = self._gen_fname(
self.inputs.in_file, suffix=self.inputs.apply_suffix)
+ else:
+ outputs['brain_file'] = os.path.abspath(self.inputs.apply_mask)
return outputs
@@ -706,17 +714,20 @@ def _gen_filename(self, name):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.in_file,
suffix=self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- outputs['oned_file'] = os.path.abspath(self.inputs.oned_file)
- if not isdefined(outputs['oned_file']):
+ if not isdefined(self.inputs.oned_file):
outputs['oned_file'] = fname_presuffix(
self.inputs.in_file,
suffix = '%s.1D'%self.inputs.suffix,
use_ext = False, newpath = os.getcwd())
+ else:
+ outputs['oned_file'] = os.path.abspath(self.inputs.oned_file)
return outputs
@@ -771,10 +782,11 @@ class Merge(AFNICommand):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.in_files[0],
suffix=self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
def _gen_filename(self, name):
@@ -825,10 +837,11 @@ class Copy(AFNICommand):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.in_file,
suffix=self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
def _gen_filename(self, name):
@@ -891,10 +904,11 @@ class Fourier(AFNICommand):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.in_file,
- suffix=self.inputs.suffix)
+ suffix = self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
def _gen_filename(self, name):
@@ -948,10 +962,11 @@ class ZCutUp(AFNICommand):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.in_file,
- suffix=self.inputs.suffix)
+ suffix = self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
def _gen_filename(self, name):
@@ -1005,10 +1020,11 @@ class Allineate(AFNICommand):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.in_file,
- suffix=self.inputs.suffix)
+ suffix = self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
def _gen_filename(self, name):
@@ -1069,10 +1085,11 @@ class Maskave(AFNICommand):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.in_file,
- suffix=self.inputs.suffix)
+ suffix = self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
def _gen_filename(self, name):
@@ -1123,10 +1140,11 @@ class SkullStrip(AFNICommand):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.in_file,
- suffix=self.inputs.suffix)
+ suffix = self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
def _gen_filename(self, name):
@@ -1180,10 +1198,11 @@ class TCat(AFNICommand):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.in_files[0],
suffix=self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
def _gen_filename(self, name):
@@ -1246,10 +1265,11 @@ class Fim(AFNICommand):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.in_file,
- suffix=self.inputs.suffix)
+ suffix = self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
def _gen_filename(self, name):
@@ -1317,10 +1337,12 @@ class TCorrelate(AFNICommand):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.xset,
suffix=self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
def _gen_filename(self, name):
@@ -1491,7 +1513,7 @@ def aggregate_outputs(self, runtime=None, needed_outputs=None):
"""
-class CalcInputSpec(CommandLineInputSpec):
+class CalcInputSpec(AFNITraitedSpec):
in_file_a = File(desc='input file to 3dcalc',
argstr='-a %s', position=0, mandatory=True)
in_file_b = File(desc='operand file to 3dcalc',
@@ -1513,7 +1535,7 @@ class CalcOutputSpec(TraitedSpec):
out_file = File(desc=' output file', exists=True)
-class Calc(CommandLine):
+class Calc(AFNICommand):
"""This program does voxel-by-voxel arithmetic on 3D datasets
For complete details, see the `3dcalc Documentation.
@@ -1540,10 +1562,11 @@ class Calc(CommandLine):
def _list_outputs(self):
outputs = self.output_spec().get()
- outputs['out_file'] = os.path.abspath(self.inputs.out_file)
- if not isdefined(outputs['out_file']):
+ if not isdefined(self.inputs.out_file):
outputs['out_file'] = self._gen_fname(self.inputs.in_file_a,
suffix=self.inputs.suffix)
+ else:
+ outputs['out_file'] = os.path.abspath(self.inputs.out_file)
return outputs
def _gen_filename(self, name):
View
4 nipype/interfaces/afni/tests/test_preprocess.py
@@ -132,7 +132,7 @@ def test_tcat():
input_map = dict(args = dict(argstr='%s',),
environ = dict(usedefault=True,),
ignore_exception = dict(usedefault=True,),
- in_file = dict(argstr=' %s',mandatory=True,),
+ in_files = dict(argstr=' %s',mandatory=True,),
out_file = dict(argstr='-prefix %s',),
outputtype = dict(),
rlt = dict(argstr='-rlt%s',),
@@ -288,7 +288,7 @@ def test_merge():
doall = dict(argstr='-doall',),
environ = dict(usedefault=True,),
ignore_exception = dict(usedefault=True,),
- in_file = dict(argstr='%s',mandatory=True,),
+ in_files = dict(argstr='%s',mandatory=True,),
other = dict(argstr='%s',),
out_file = dict(argstr='-prefix %s',genfile=True,),
outputtype = dict(),
Something went wrong with that request. Please try again.