File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -520,7 +520,7 @@ def populate_intended_for(path_to_bids_session):
520
520
j for j in glob (op .join (path_to_bids_session , '*/*.json' )) if not (
521
521
j in fmap_jsons
522
522
# j[:-5] removes the '.json' from the end
523
- or j [- 5 ].endswith ('_sbref' )
523
+ or j [: - 5 ].endswith ('_sbref' )
524
524
)
525
525
)
526
526
@@ -568,9 +568,11 @@ def populate_intended_for(path_to_bids_session):
568
568
jsons_accounted_for .add (image_json )
569
569
if len (intended_for ) > 0 :
570
570
fm_json_name = op .basename (fm_json )
571
- # get from "_acq-"/"_run-" to the next "_":
572
- acq_str = '_acq-' + fm_json_name .split ('_acq-' )[1 ].split ('_' )[0 ]
573
- run_str = '_run-' + fm_json_name .split ('_run-' )[1 ].split ('_' )[0 ]
571
+ # get <acq> and <run> labels:
572
+ acq_match = re .findall ('([/_]acq-([a-zA-Z0-9]*))' , fm_json_name )
573
+ acq_str = acq_match [0 ][0 ] if acq_match else ''
574
+ run_match = re .findall ('([/_]run-([a-zA-Z0-9]*))' , fm_json_name )
575
+ run_str = run_match [0 ][0 ] if run_match else ''
574
576
# Loop through all the files that have the same "acq-" and "run-"
575
577
intended_for = sorted ([str (f ) for f in intended_for ])
576
578
for other_fm_json in glob (op .join (path_to_bids_session , 'fmap/*' + acq_str + '*' + run_str + '*.json' )):
You can’t perform that action at this time.
0 commit comments