@@ -314,8 +314,9 @@ def fix_multiple_dots(uploaded_img_list):
314
314
fix = True
315
315
ext = '.json'
316
316
elif img_file .endswith (tuple (MEG_extensions )) and img_file .count ('.' ) > 1 : # for MEG
317
- fix = True
318
- ext = img_file .split ('.' )[- 1 ]
317
+ if not img_file .endswith ('.ds' ):
318
+ fix = True
319
+ ext = '.' + img_file .split ('.' )[- 1 ]
319
320
else :
320
321
pass
321
322
@@ -385,10 +386,13 @@ def generate_MEG_json_sidecars(uploaded_img_list):
385
386
from mne_bids .config import MANUFACTURERS
386
387
387
388
for meg in MEG_img_files :
388
- ext = Path (meg ).suffix
389
+ if meg .endswith ('.ds' ):
390
+ ext = '.ds'
391
+ else :
392
+ ext = Path (meg ).suffix
389
393
390
394
fname = f"{ DATA_DIR } /{ meg } "
391
- json_output_name = fname .split ("." )[0 ] + ".json"
395
+ json_output_name = fname .split (ext )[0 ] + ".json"
392
396
raw = mne .io .read_raw (fname , verbose = 0 )
393
397
acquisition_date_time = raw .info ["meas_date" ].strftime ("%Y-%m-%dT%H:%M:%S.%f" )
394
398
acquisition_date = acquisition_date_time .split ("T" )[0 ]
@@ -481,6 +485,8 @@ def modify_uploaded_dataset_list(uploaded_img_list):
481
485
ext = '.nii.gz'
482
486
elif img_file .endswith ('.v.gz' ):
483
487
ext = '.v.gz'
488
+ elif img_file .endswith ('.ds' ):
489
+ ext = '.ds'
484
490
else :
485
491
ext = Path (img_file ).suffix
486
492
@@ -918,6 +924,8 @@ def generate_dataset_list(uploaded_files_list, exclude_data):
918
924
ext = '.nii.gz'
919
925
elif img_file .endswith ('.v.gz' ):
920
926
ext = '.v.gz'
927
+ elif img_file .endswith ('.ds' ):
928
+ ext = '.ds'
921
929
else :
922
930
ext = Path (img_file ).suffix
923
931
@@ -2931,7 +2939,10 @@ def modify_objects_info(dataset_list):
2931
2939
"pngPaths" : [],
2932
2940
"headers" : protocol ["headers" ]})
2933
2941
elif item .endswith (tuple (MEG_extensions )):
2934
- name = Path (item ).suffix
2942
+ if item .endswith ('.ds' ):
2943
+ name = '.ds'
2944
+ else :
2945
+ name = Path (item ).suffix
2935
2946
items .append ({"path" : item ,
2936
2947
"name" : name ,
2937
2948
"pngPaths" : [],
@@ -3028,7 +3039,6 @@ def extract_series_info(dataset_list_unique_series):
3028
3039
uploaded_img_list = fix_multiple_dots (uploaded_img_list )
3029
3040
3030
3041
# Generate MEG json files, if MEG data was provided
3031
- # uploaded_img_list = generate_MEG_json_sidecars(uploaded_img_list)
3032
3042
generate_MEG_json_sidecars (uploaded_img_list )
3033
3043
3034
3044
# Filter uploaded files list for files that ezBIDS can't use and check for ezBIDS configuration file
0 commit comments