Skip to content

Commit d91f6d2

Browse files
author
Oweda
committed
FIX nipy#3653: added option for using compressed files as inputs in CAT12 interface
1 parent 8c2a4ba commit d91f6d2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nipype/interfaces/cat12/preprocess.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
isdefined,
99
File,
1010
Str,
11+
ImageFile,
1112
)
1213
from nipype.interfaces.cat12.base import Cell
1314

@@ -23,7 +24,7 @@
2324

2425
class CAT12SegmentInputSpec(SPMCommandInputSpec):
2526
in_files = InputMultiPath(
26-
ImageFileSPM(exists=True),
27+
ImageFile(exists=True),
2728
field="data",
2829
desc="file to segment",
2930
mandatory=True,
@@ -559,6 +560,8 @@ def _format_arg(self, opt, spec, val):
559560
"""Convert input to appropriate format for spm"""
560561
if opt == "in_files":
561562
if isinstance(val, list):
563+
if '.nii.gz' in val[0]:
564+
return scans_for_fnames(val, keep4d=True)
562565
return scans_for_fnames(val)
563566
else:
564567
return scans_for_fname(val)
@@ -571,7 +574,8 @@ def _list_outputs(self):
571574
outputs = self._outputs().get()
572575
f = self.inputs.in_files[0]
573576
pth, base, ext = split_filename(f)
574-
577+
if '.nii.gz' in f:
578+
f = f[:-3]
575579
outputs["mri_images"] = [
576580
str(mri) for mri in Path(pth).glob("mri/*") if mri.is_file()
577581
]

0 commit comments

Comments
 (0)