Skip to content

Commit 9707b36

Browse files
committed
Output warp fields and jacobian correction files in TOPUP.
1 parent 6c23846 commit 9707b36

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

nipype/interfaces/fsl/epi.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
from ..base import (traits, TraitedSpec, InputMultiPath, File,
2828
isdefined)
29-
from .base import FSLCommand, FSLCommandInputSpec
29+
from .base import FSLCommand, FSLCommandInputSpec, Info
3030

3131

3232
class PrepareFieldmapInputSpec(FSLCommandInputSpec):
@@ -140,6 +140,13 @@ class TOPUPInputSpec(FSLCommandInputSpec):
140140
out_field = File(argstr='--fout=%s', hash_files=False,
141141
name_source=['in_file'], name_template='%s_field',
142142
desc='name of image file with field (Hz)')
143+
out_warp_prefix = traits.Str("warpfield", argstr='--dfout=%s', hash_files=False,
144+
desc='prefix for the warpfield images (in mm)',
145+
usedefault=True)
146+
out_jac_prefix = traits.Str("jac", argstr='--jacout=%s',
147+
hash_files=False,
148+
desc='prefix for the warpfield images',
149+
usedefault=True)
143150
out_corrected = File(argstr='--iout=%s', hash_files=False,
144151
name_source=['in_file'], name_template='%s_corrected',
145152
desc='name of 4D image file with unwarped images')
@@ -212,6 +219,8 @@ class TOPUPOutputSpec(TraitedSpec):
212219
out_movpar = File(exists=True, desc='movpar.txt output file')
213220
out_enc_file = File(desc='encoding directions file output for applytopup')
214221
out_field = File(desc='name of image file with field (Hz)')
222+
out_warps = traits.List(File(exists=True), desc='warpfield images')
223+
out_jacs = traits.List(File(exists=True), desc='Jacobian images')
215224
out_corrected = File(desc='name of 4D image file with unwarped images')
216225
out_logfile = File(desc='name of log-file')
217226

@@ -269,6 +278,13 @@ def _list_outputs(self):
269278
cwd=base_path)
270279
outputs['out_movpar'] = self._gen_fname(base, suffix='_movpar',
271280
ext='.txt', cwd=base_path)
281+
n_vols = nb.load(self.inputs.in_file).shape[-1]
282+
283+
outputs['out_warps'] = [os.path.abspath(self.inputs.out_warp_prefix + "_%02d" % (i+1) + Info.output_type_to_ext(self.inputs.output_type)) for i in range(n_vols)]
284+
outputs['out_jacs'] = [os.path.abspath(
285+
self.inputs.out_jac_prefix + "_%02d" % (
286+
i + 1) + Info.output_type_to_ext(self.inputs.output_type)) for i in
287+
range(n_vols)]
272288

273289
if isdefined(self.inputs.encoding_direction):
274290
outputs['out_enc_file'] = self._get_encfilename()

0 commit comments

Comments
 (0)