Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nipype/interfaces/afni/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def set_default_output_type(cls, outputtype):
else:
raise AttributeError('Invalid AFNI outputtype: %s' % outputtype)

def _overload_extension(self, value):
def _overload_extension(self, value, name=None):
path, base, _ = split_filename(value)
return os.path.join(path, base + Info.outputtype_to_ext(self.inputs.outputtype))

Expand Down
4 changes: 2 additions & 2 deletions nipype/interfaces/afni/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ class AutoTcorrelate(AFNICommand):
output_spec = AFNICommandOutputSpec
_cmd = '3dAutoTcorrelate'

def _overload_extension(self, value):
def _overload_extension(self, value, name=None):
path, base, ext = split_filename(value)
if ext.lower() not in [".1d", ".nii.gz", ".nii"]:
ext = ext + ".1D"
Expand Down Expand Up @@ -1924,7 +1924,7 @@ class AFNItoNIFTI(AFNICommand):
input_spec = AFNItoNIFTIInputSpec
output_spec = AFNICommandOutputSpec

def _overload_extension(self, value):
def _overload_extension(self, value, name=None):
path, base, ext = split_filename(value)
if ext.lower() not in [".1d", ".nii.gz", ".1D"]:
ext = ext + ".nii"
Expand Down
4 changes: 2 additions & 2 deletions nipype/interfaces/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1492,13 +1492,13 @@ def _filename_from_source(self, name):
_, _, ext = split_filename(retval)
if trait_spec.keep_extension and ext:
return retval
return self._overload_extension(retval)
return self._overload_extension(retval, name)
return retval

def _gen_filename(self, name):
raise NotImplementedError

def _overload_extension(self, value):
def _overload_extension(self, value, name=None):
return value

def _list_outputs(self):
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/fsl/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True,
use_ext=False, newpath=cwd)
return fname

def _overload_extension(self, value):
def _overload_extension(self, value, name=None):
return value + Info.output_type_to_ext(self.inputs.output_type)


Expand Down
301 changes: 162 additions & 139 deletions nipype/interfaces/fsl/epi.py

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions nipype/interfaces/fsl/tests/test_auto_ApplyTOPUP.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,28 @@ def test_ApplyTOPUP_inputs():
ignore_exception=dict(nohash=True,
usedefault=True,
),
in_files=dict(argstr='%s',
in_files=dict(argstr='--imain=%s',
mandatory=True,
sep=',',
),
in_index=dict(argstr='%s',
in_index=dict(argstr='--inindex=%s',
mandatory=True,
sep=',',
),
in_topup=dict(argstr='--topup=%s',
mandatory=True,
in_topup_fieldcoef=dict(argstr='--topup=%s',
copyfile=False,
requires=['in_topup_movpar'],
),
in_topup_movpar=dict(copyfile=False,
requires=['in_topup_fieldcoef'],
),
interp=dict(argstr='--interp=%s',
),
method=dict(argstr='--method=%s',
),
out_base=dict(argstr='--out=%s',
out_corrected=dict(argstr='--out=%s',
name_source=['in_files'],
name_template='%s_corrected',
),
output_type=dict(),
terminal_output=dict(mandatory=True,
Expand Down
27 changes: 24 additions & 3 deletions nipype/interfaces/fsl/tests/test_auto_TOPUP.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ def test_TOPUP_inputs():
config=dict(argstr='--config=%s',
usedefault=True,
),
encoding_direction=dict(),
encoding_direction=dict(argstr='--datain=%s',
mandatory=True,
requires=['readout_times'],
xor=['encoding_file'],
),
encoding_file=dict(argstr='--datain=%s',
mandatory=True,
xor=['encoding_direction'],
),
environ=dict(nohash=True,
usedefault=True,
Expand All @@ -33,15 +39,31 @@ def test_TOPUP_inputs():
numprec=dict(argstr='--numprec=%s',
),
out_base=dict(argstr='--out=%s',
hash_files=False,
name_source=['in_file'],
name_template='%s_base',
),
out_corrected=dict(argstr='--iout=%s',
hash_files=False,
name_source=['in_file'],
name_template='%s_corrected',
),
out_field=dict(argstr='--fout=%s',
hash_files=False,
name_source=['in_file'],
name_template='%s_field',
),
out_logfile=dict(argstr='--logout=%s',
hash_files=False,
keep_extension=True,
name_source=['in_file'],
name_template='%s_topup.log',
),
output_type=dict(),
readout_times=dict(),
readout_times=dict(mandatory=True,
requires=['encoding_direction'],
xor=['encoding_file'],
),
regrid=dict(argstr='--regrid=%d',
),
scale=dict(argstr='--scale=%d',
Expand Down Expand Up @@ -69,7 +91,6 @@ def test_TOPUP_outputs():
out_fieldcoef=dict(),
out_logfile=dict(),
out_movpar=dict(),
out_topup=dict(),
)
outputs = TOPUP.output_spec()

Expand Down
Empty file.
Empty file.
8 changes: 4 additions & 4 deletions nipype/workflows/dmri/fsl/epi.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def topup_correction( name='topup_correction' ):
>>> nipype_epicorrect = topup_correction('nipype_topup')
>>> nipype_epicorrect.inputs.inputnode.in_file_dir = 'epi.nii'
>>> nipype_epicorrect.inputs.inputnode.in_file_rev = 'epi_rev.nii'
>>> nipype_epicorrect.inputs.inputnode.encoding_direction = 'y'
>>> nipype_epicorrect.inputs.inputnode.encoding_direction = ['y', 'y-']
>>> nipype_epicorrect.inputs.inputnode.ref_num = 0
>>> nipype_epicorrect.run() # doctest: +SKIP

Expand Down Expand Up @@ -400,7 +400,6 @@ def topup_correction( name='topup_correction' ):
outputnode = pe.Node( niu.IdentityInterface(
fields=['out_fieldcoef',
'out_movpar',
'out_topup',
'out_enc_file',
'epi_corrected'
]), name='outputnode'
Expand All @@ -424,10 +423,11 @@ def topup_correction( name='topup_correction' ):
,(combin, merged, [('out', 'in_files')] )
,(merged, topup, [('merged_file','in_file')])
,(inputnode, topup, [('encoding_direction','encoding_direction'),('readout_times','readout_times') ])
,(topup, applytopup, [('out_topup','in_topup'),('out_enc_file','encoding_file')])
,(topup, applytopup, [('out_fieldcoef','in_topup_fieldcoef'),('out_movpar','in_topup_movpar'),
('out_enc_file','encoding_file')])
,(combin2, applytopup, [('out','in_files')] )
,(topup, outputnode, [('out_fieldcoef','out_fieldcoef'),('out_movpar','out_movpar'),
('out_topup','out_topup'),('out_enc_file','out_enc_file') ])
('out_enc_file','out_enc_file') ])
,(applytopup,outputnode, [('out_corrected','epi_corrected')])
])

Expand Down