Skip to content

Commit 820f383

Browse files
committed
Satra suggestion of FSLcpgeom
1 parent 91893ad commit 820f383

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

nipype/interfaces/fsl/utils.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class CopyGeomInputSpec(FSLCommandInputSpec):
3535
in_file = File(exists=True, mandatory=True, argstr="%s", position=0,
3636
desc="source image")
3737
dest_file = File(exists=True, mandatory=True, argstr="%s", position=1,
38-
desc="destination image", copyfile=True)
38+
desc="destination image", copyfile=True, output_name='out_file',
39+
name_source='dest_file', name_template='%s')
3940
ignore_dims = traits.Bool(desc=('Do not copy image dimensions'),
4041
argstr='-d', position="-1")
4142

@@ -44,37 +45,16 @@ class CopyGeomOutputSpec(TraitedSpec):
4445

4546
class CopyGeom(FSLCommand):
4647
"""Use fslcpgeom to copy the header geometry information to another image.
47-
4848
Copy certain parts of the header information (image dimensions, voxel dimensions,
4949
voxel dimensions units string, image orientation/origin or qform/sform info)
5050
from one image to another. Note that only copies from Analyze to Analyze
5151
or Nifti to Nifti will work properly. Copying from different files will result
5252
in loss of information or potentially incorrect settings.
53-
5453
"""
5554
_cmd = "fslcpgeom"
5655
input_spec = CopyGeomInputSpec
5756
output_spec = CopyGeomOutputSpec
5857

59-
def _run_interface(self, runtime):
60-
# Copy destination file to new local file to prevent overwriting
61-
# and update destination file
62-
out_file = self._gen_filename('out_file')
63-
copyfile(self.inputs.dest_file, out_file, copy=True)
64-
self.inputs.dest_file = out_file
65-
return super(CopyGeom, self)._run_interface(runtime)
66-
67-
def _gen_filename(self, name):
68-
if name == 'out_file':
69-
return self._gen_fname(self.inputs.dest_file, suffix="_newhd")
70-
return None
71-
72-
def _list_outputs(self):
73-
outputs = self.output_spec().get()
74-
# Use the new destination file updated by _run_interface
75-
outputs['out_file'] = self.inputs.dest_file
76-
return outputs
77-
7858

7959
class RobustFOVInputSpec(FSLCommandInputSpec):
8060
in_file = File(exists=True,

0 commit comments

Comments
 (0)