Skip to content

Commit 46e659b

Browse files
committed
Added support for the -z compress option
1 parent d83b06d commit 46e659b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

nipype/interfaces/bru2nii.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ class Bru2InputSpec(CommandLineInputSpec):
2323
argstr='-f',
2424
desc="Force conversion of localizers images (multiple slice "
2525
"orientations).")
26+
compress = traits.Bool(
27+
argstr='-z', desc='gz compress images (".nii.gz").')
2628
append_protocol_name = traits.Bool(
2729
argstr='-p', desc="Append protocol name to output filename.")
2830
output_filename = traits.Str(
2931
argstr="-o %s",
30-
desc="Output filename ('.nii' will be appended)",
32+
desc='Output filename (".nii" will be appended, or ".nii.gz" if the "-z" compress option is selected)',
3133
genfile=True)
3234

3335

@@ -57,7 +59,10 @@ def _list_outputs(self):
5759
output_filename1 = os.path.abspath(self.inputs.output_filename)
5860
else:
5961
output_filename1 = self._gen_filename('output_filename')
60-
outputs["nii_file"] = output_filename1 + ".nii"
62+
if self.inputs.compress:
63+
outputs["nii_file"] = output_filename1 + ".nii.gz"
64+
else:
65+
outputs["nii_file"] = output_filename1 + ".nii"
6166
return outputs
6267

6368
def _gen_filename(self, name):

nipype/interfaces/tests/test_auto_Bru2.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def test_Bru2_inputs():
88
actual_size=dict(argstr='-a', ),
99
append_protocol_name=dict(argstr='-p', ),
1010
args=dict(argstr='%s', ),
11+
compress=dict(argstr='-z', ),
1112
environ=dict(
1213
nohash=True,
1314
usedefault=True,

0 commit comments

Comments
 (0)