@@ -315,12 +315,12 @@ def fmap_info(metadata, img, config, layout):
315315 run_dict = {}
316316 for scan in scans :
317317 fn = basename (scan )
318- iff_file = [f for f in layout .get (extensions = 'nii.gz' ) if fn in f .filename ][0 ]
318+ iff_file = [f for f in layout .get (extensions = 'nii.gz' ) if fn in f .path ][0 ]
319319 run_num = int (iff_file .run )
320- ty = iff_file .suffix .upper ()
320+ ty = iff_file .entities [ ' suffix' ] .upper ()
321321 if ty == 'BOLD' :
322- iff_meta = layout .get_metadata (iff_file .filename )
323- task = iff_meta .get ('TaskName' , iff_file .task )
322+ iff_meta = layout .get_metadata (iff_file .path )
323+ task = iff_meta .get ('TaskName' , iff_file .entities [ ' task' ] )
324324 ty_str = '{0} {1} scan' .format (task , ty )
325325 else :
326326 ty_str = '{0} scan' .format (ty )
@@ -437,41 +437,42 @@ def parse_niftis(layout, niftis, subj, config, **kwargs):
437437 if not description_list :
438438 description_list .append (general_acquisition_info (metadata ))
439439
440- if nifti_struct .datatype == 'func' :
441- if not skip_task .get (nifti_struct .task , False ):
440+ if nifti_struct .entities [ ' datatype' ] == 'func' :
441+ if not skip_task .get (nifti_struct .entities [ ' task' ] , False ):
442442 echos = layout .get_echoes (subject = subj , extensions = 'nii.gz' ,
443- task = nifti_struct .task , ** kwargs )
443+ task = nifti_struct .entities ['task' ],
444+ ** kwargs )
444445 n_echos = len (echos )
445446 if n_echos > 0 :
446447 metadata ['EchoTime' ] = []
447448 for echo in sorted (echos ):
448449 echo_struct = layout .get (subject = subj , echo = echo ,
449450 extensions = 'nii.gz' ,
450- task = nifti_struct .task ,
451+ task = nifti_struct .entities [ ' task' ] ,
451452 ** kwargs )[0 ]
452- echo_file = echo_struct .filename
453+ echo_file = echo_struct .path
453454 echo_meta = layout .get_metadata (echo_file )
454455 metadata ['EchoTime' ].append (echo_meta ['EchoTime' ])
455456
456457 n_runs = len (layout .get_runs (subject = subj ,
457- task = nifti_struct .task ,
458+ task = nifti_struct .entities [ ' task' ] ,
458459 ** kwargs ))
459- description_list .append (func_info (nifti_struct .task ,
460+ description_list .append (func_info (nifti_struct .entities [ ' task' ] ,
460461 n_runs , metadata , img ,
461462 config ))
462- skip_task [nifti_struct .task ] = True
463+ skip_task [nifti_struct .entities [ ' task' ] ] = True
463464
464- elif nifti_struct .datatype == 'anat' :
465- suffix = nifti_struct .suffix
465+ elif nifti_struct .entities [ ' datatype' ] == 'anat' :
466+ suffix = nifti_struct .entities [ ' suffix' ]
466467 if suffix .endswith ('w' ):
467468 suffix = suffix [:- 1 ] + '-weighted'
468469 description_list .append (anat_info (suffix , metadata , img ,
469470 config ))
470- elif nifti_struct .datatype == 'dwi' :
471+ elif nifti_struct .entities [ ' datatype' ] == 'dwi' :
471472 bval_file = nii_file .replace ('.nii.gz' , '.bval' )
472473 description_list .append (dwi_info (bval_file , metadata , img ,
473474 config ))
474- elif nifti_struct .datatype == 'fmap' :
475+ elif nifti_struct .entities [ ' datatype' ] == 'fmap' :
475476 description_list .append (fmap_info (metadata , img , config ,
476477 layout ))
477478
0 commit comments