|
13 | 13 | from ...utils.filemanip import (load_json, save_json, split_filename,
|
14 | 14 | fname_presuffix)
|
15 | 15 | from ..base import (CommandLineInputSpec, CommandLine, TraitedSpec, traits,
|
16 |
| - isdefined, File, InputMultiPath, Undefined, Str, |
| 16 | + isdefined, File, InputMultiPath, Undefined, Str, |
17 | 17 | InputMultiObject)
|
18 | 18 |
|
19 | 19 | from .base import (AFNICommandBase, AFNICommand, AFNICommandInputSpec,
|
@@ -2563,7 +2563,7 @@ class TProject(AFNICommand):
|
2563 | 2563 | _cmd = '3dTproject'
|
2564 | 2564 | input_spec = TProjectInputSpec
|
2565 | 2565 | output_spec = AFNICommandOutputSpec
|
2566 |
| - |
| 2566 | + |
2567 | 2567 |
|
2568 | 2568 | class TShiftInputSpec(AFNICommandInputSpec):
|
2569 | 2569 | in_file = File(
|
@@ -2791,12 +2791,12 @@ class WarpInputSpec(AFNICommandInputSpec):
|
2791 | 2791 | verbose = traits.Bool(
|
2792 | 2792 | desc='Print out some information along the way.', argstr='-verb')
|
2793 | 2793 | save_warp = traits.Bool(
|
2794 |
| - False, usedefault=True, desc='save warp as .mat file') |
| 2794 | + desc='save warp as .mat file', requires=['verbose']) |
2795 | 2795 |
|
2796 | 2796 |
|
2797 | 2797 | class WarpOutputSpec(TraitedSpec):
|
2798 | 2798 | out_file = File(desc='Warped file.', exists=True)
|
2799 |
| - warp_file = File(desc='warp transfrom .mat file') |
| 2799 | + warp_file = File(desc='warp transform .mat file') |
2800 | 2800 |
|
2801 | 2801 |
|
2802 | 2802 | class Warp(AFNICommand):
|
@@ -2835,39 +2835,16 @@ def _run_interface(self, runtime):
|
2835 | 2835 |
|
2836 | 2836 | if self.inputs.save_warp:
|
2837 | 2837 | import numpy as np
|
2838 |
| - if not self.inputs.out_file: |
2839 |
| - warp_file = fname_presuffix(self.inputs.in_file, |
2840 |
| - suffix='_warp_transform.mat', |
2841 |
| - use_ext=False) |
2842 |
| - else: |
2843 |
| - warp_file = fname_presuffix(self.inputs.out_file, |
2844 |
| - suffix='_transform.mat', |
2845 |
| - use_ext=False) |
| 2838 | + warp_file = self._list_outputs()['warp_file'] |
2846 | 2839 | np.savetxt(warp_file, [runtime.stdout], fmt=str('%s'))
|
2847 | 2840 | return runtime
|
2848 | 2841 |
|
2849 | 2842 | def _list_outputs(self):
|
2850 |
| - outputs = self.output_spec().get() |
2851 |
| - if not self.inputs.out_file: |
2852 |
| - fname, ext = os.path.splitext(self.inputs.in_file) |
2853 |
| - if '.gz' in ext: |
2854 |
| - _, ext2 = os.path.splitext(fname) |
2855 |
| - ext = ext2 + ext |
2856 |
| - out_file = self._gen_fname(self.inputs.in_file, suffix='_warp', |
2857 |
| - ext=ext) |
2858 |
| - outputs['out_file'] = os.path.abspath(out_file) |
2859 |
| - if self.inputs.save_warp: |
2860 |
| - warp_file = fname_presuffix(self.inputs.in_file, |
2861 |
| - suffix='_warp_transform.mat', |
2862 |
| - use_ext=False) |
2863 |
| - outputs['warp_file'] = os.path.abspath(warp_file) |
2864 |
| - else: |
2865 |
| - outputs['out_file'] = os.path.abspath(self.inputs.out_file) |
2866 |
| - if self.inputs.save_warp: |
2867 |
| - warp_file = fname_presuffix(self.inputs.out_file, |
2868 |
| - suffix='_transform.mat', |
2869 |
| - use_ext=False) |
2870 |
| - outputs['warp_file'] = os.path.abspath(warp_file) |
| 2843 | + outputs = super(Warp, self)._list_outputs() |
| 2844 | + if self.inputs.save_warp: |
| 2845 | + outputs['warp_file'] = fname_presuffix(outputs['out_file'], |
| 2846 | + suffix='_transform.mat', |
| 2847 | + use_ext=False) |
2871 | 2848 |
|
2872 | 2849 | return outputs
|
2873 | 2850 |
|
|
0 commit comments