Skip to content

enh: trait for imaging files + implementation in SPM preproc #1949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 3, 2017
1 change: 1 addition & 0 deletions nipype/interfaces/afni/tests/test_auto_Autobox.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def test_Autobox_inputs():
),
out_file=dict(argstr='-prefix %s',
name_source='in_file',
name_template='%s_autobox',
),
outputtype=dict(),
padding=dict(argstr='-npad %d',
Expand Down
9 changes: 9 additions & 0 deletions nipype/interfaces/spm/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ def _parse_inputs(self):
"""validate spm realign options if set to None ignore
"""
einputs = super(Realign, self)._parse_inputs()
is_gz = lambda x: x.endswith('.gz')
if isdefined(self.inputs.in_files):
if isinstance(self.inputs.in_files, list):
for imgf in self.inputs.in_files:
if is_gz(imgf):
raise TypeError('Input files must be uncompressed')
else:
if is_gz(self.inputs.in_files):
raise TypeError('Input files must be uncompressed')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if there's a better approach in general, but the test can be made much more concise:

if isdefined(self.inputs.in_files) and any(imgf.endswith('.gz')
                                           for imgf in filename_to_list(self.inputs.in_files)):
    raise TypeError('Input files must be uncompressed')

return [{'%s' % (self.inputs.jobtype): einputs[0]}]

def _list_outputs(self):
Expand Down
2 changes: 2 additions & 0 deletions nipype/interfaces/utility/tests/test_auto_Merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ def test_Merge_inputs():
),
no_flatten=dict(usedefault=True,
),
ravel_inputs=dict(usedefault=True,
),
)
inputs = Merge.input_spec()

Expand Down