@@ -69,7 +69,7 @@ def parse_json(json_file):
6969 # print(str(input_dict))
7070 mandatory_keys = ['destination' , 'project' , 'server' ]
7171 optional_keys = ['zero_pad' , 'session_labels' , 'subjects' , 'scan_labels' ,
72- 'scan_dict' , 'num_digits' , 'sub_dict' ]
72+ 'scan_dict' , 'num_digits' , 'sub_dict' , 'sub_label_prefix' ]
7373 total_keys = mandatory_keys + optional_keys
7474 # print("total_keys: "+str(total_keys))
7575 # are there any inputs in the json_file that are not supported?
@@ -265,7 +265,7 @@ def get_scans(self, ses_label, scan_labels=None):
265265 self .scan_dict [key ] = scan_obj
266266
267267 def download_scan_unformatted (self , scan , dest , scan_repl_dict , bids_num_len ,
268- sub_repl_dict = None ):
268+ sub_repl_dict = None , sub_label_prefix = None ):
269269 """
270270 Downloads a particular scan session
271271
@@ -346,7 +346,12 @@ def download_scan_unformatted(self, scan, dest, scan_repl_dict, bids_num_len,
346346 if scan_pattern_dict ['modality' ] is None :
347347 print ('{scan} is not in BIDS, not converting' .format (scan = scan ))
348348 return 0
349-
349+
350+ # adding additional information to scan label (such as GE120)
351+ if sub_label_prefix is not None :
352+ sub_label = sub_name .split ('-' )[1 ]
353+ sub_name = 'sub-' + sub_label_prefix + sub_label
354+
350355 # build up the bids directory
351356 bids_dir = os .path .join (dest , sub_name , ses_name , scan_pattern_dict ['modality' ])
352357
@@ -385,7 +390,7 @@ def download_scan_unformatted(self, scan, dest, scan_repl_dict, bids_num_len,
385390 else :
386391 print ('It appears the nifti file already exists for {scan}' .format (scan = scan ))
387392
388- def download_scan (self , scan , dest ):
393+ def download_scan (self , scan , dest , sub_label_prefix = None ):
389394 """
390395 Downloads a particular scan session
391396
@@ -453,6 +458,12 @@ def download_scan(self, scan, dest):
453458 if scan_pattern_dict ['modality' ] is None :
454459 print ('{scan} is not in BIDS, not converting' .format (scan = scan ))
455460 return 0
461+
462+ # adding additional information to scan label (such as GE120)
463+ if sub_label_prefix is not None :
464+ sub_label = sub_name .split ('-' )[1 ]
465+ sub_name = 'sub-' + sub_label_prefix + sub_label
466+
456467 # build up the bids directory
457468 bids_dir = os .path .join (dest , sub_name , ses_name , scan_pattern_dict ['modality' ])
458469
@@ -513,6 +524,7 @@ def main():
513524 dest = input_dict .get ('destination' , None )
514525 scan_repl_dict = input_dict .get ('scan_dict' , None )
515526 sub_repl_dict = input_dict .get ('sub_dict' , None )
527+ sub_label_prefix = input_dict .get ('sub_label_prefix' , None )
516528
517529 if session_labels == "None" :
518530 session_labels = None
@@ -557,9 +569,9 @@ def main():
557569 # download the scan
558570 if scan_repl_dict :
559571 sub_class .download_scan_unformatted (scan , dest , scan_repl_dict , bids_num_len ,
560- sub_repl_dict )
572+ sub_repl_dict , sub_label_prefix )
561573 else :
562- sub_class .download_scan (scan , dest )
574+ sub_class .download_scan (scan , dest , sub_label_prefix )
563575
564576
565577if __name__ == "__main__" :
0 commit comments