File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 24
24
25
25
import json
26
26
from collections import OrderedDict
27
+ from collections .abc import Iterable
27
28
from pathlib import Path
28
29
29
30
import pandas as pd
@@ -237,6 +238,14 @@ def _flatten_dict(indict):
237
238
return out_qc
238
239
239
240
241
+ def _flatten_list (xs ):
242
+ for x in xs :
243
+ if isinstance (x , Iterable ) and not isinstance (x , (str , bytes )):
244
+ yield from _flatten_list (x )
245
+ else :
246
+ yield x
247
+
248
+
240
249
def _datalad_get (input_list , nprocs = None ):
241
250
from mriqc import config
242
251
@@ -255,7 +264,7 @@ def _datalad_get(input_list, nprocs=None):
255
264
25 , 'DataLad dataset identified, attempting to `datalad get` unavailable files.'
256
265
)
257
266
return get (
258
- input_list ,
267
+ list ( _flatten_list ( input_list )) ,
259
268
dataset = str (config .execution .bids_dir ),
260
269
jobs = nprocs
261
270
if not None
Original file line number Diff line number Diff line change 43
43
This workflow is orchestrated by :py:func:`fmri_qc_workflow`.
44
44
"""
45
45
46
+ from collections .abc import Iterable
47
+
46
48
import nibabel as nb
47
49
from nipype .interfaces import utility as niu
48
50
from nipype .pipeline import engine as pe
@@ -87,7 +89,11 @@ def fmri_qc_workflow(name='funcMRIQC'):
87
89
full_files = []
88
90
for bold_path in dataset :
89
91
try :
90
- bold_len = nb .load (bold_path ).shape [3 ]
92
+ bold_len = nb .load (
93
+ bold_path [0 ]
94
+ if isinstance (bold_path , Iterable ) and not isinstance (bold_path , (str , bytes ))
95
+ else bold_path
96
+ ).shape [3 ]
91
97
except nb .filebasedimages .ImageFileError :
92
98
bold_len = config .workflow .min_len_bold
93
99
except IndexError : # shape has only 3 elements
You can’t perform that action at this time.
0 commit comments