33"""
44
55# TODO:
6- # * [PENDING] Figure out where tmp directory path is being printed.
7- # * See functions that use TmpDir class's rm_tmp_dir() function
6+ # * Add option for renaming identified unknown files
7+ # * Add file search for image files with no extensions (DICOMs)
88# * Add doc building to CI workflow.
99# * Replace triple single quotes (''') with triple double quotes (""")
1010
@@ -904,7 +904,7 @@ def source_to_bids(sub_data: SubDataInfo,
904904 append_dwi_info = append_dwi_info ,
905905 zero_pad = zero_pad ,
906906 cprss_lvl = cprss_lvl )
907- tmp .rm_tmp_dir ()
907+ _ = tmp .rm_tmp_dir ()
908908 return (imgs ,
909909 jsons ,
910910 bvals ,
@@ -929,7 +929,7 @@ def source_to_bids(sub_data: SubDataInfo,
929929 append_dwi_info = append_dwi_info ,
930930 zero_pad = zero_pad ,
931931 cprss_lvl = cprss_lvl )
932- tmp .rm_tmp_dir ()
932+ _ = tmp .rm_tmp_dir ()
933933 return (imgs ,
934934 jsons ,
935935 bvals ,
@@ -991,13 +991,13 @@ def source_to_bids(sub_data: SubDataInfo,
991991 else :
992992 bvecs .append ("" )
993993 # Clean-up
994- tmp .rm_tmp_dir ()
994+ _ = tmp .rm_tmp_dir ()
995995 return (imgs ,
996996 jsons ,
997997 bvals ,
998998 bvecs )
999999 except ConversionError :
1000- tmp .rm_tmp_dir ()
1000+ _ = tmp .rm_tmp_dir ()
10011001 return ["" ],["" ],["" ],["" ]
10021002
10031003def nifti_to_bids (sub_data : SubDataInfo ,
@@ -1075,7 +1075,7 @@ def nifti_to_bids(sub_data: SubDataInfo,
10751075
10761076 # Use TmpDir and NiiFile class context managers
10771077 with TmpDir (tmp_dir = sub_tmp , use_cwd = False ) as tmp :
1078- tmp .mk_tmp_dir ()
1078+ _ = tmp .mk_tmp_dir ()
10791079 with NiiFile (data ) as n :
10801080 [path , basename , ext ] = n .file_parts ()
10811081 img_files : List [str ] = glob .glob (os .path .join (path ,basename + "*" + ext ))
@@ -1129,7 +1129,11 @@ def nifti_to_bids(sub_data: SubDataInfo,
11291129 elif (not img_data .jsons [i ]) and (i == 0 ):
11301130 json_dict : Dict = read_json (json_file = "" )
11311131
1132+ param_dict : Dict = get_data_params (file = data ,
1133+ json_file = img_data .jsons [i ])
1134+
11321135 metadata : Dict = dict_multi_update (dictionary = None , ** meta_dict )
1136+ metadata : Dict = dict_multi_update (dictionary = metadata , ** param_dict )
11331137 metadata : Dict = dict_multi_update (dictionary = metadata , ** mod_dict )
11341138
11351139 bids_dict : Dict = construct_bids_dict (meta_dict = metadata ,
@@ -1266,7 +1270,7 @@ def nifti_to_bids(sub_data: SubDataInfo,
12661270 bvals .append ("" )
12671271 bvecs .append ("" )
12681272 # Clean-up
1269- tmp .rm_tmp_dir ()
1273+ _ = tmp .rm_tmp_dir ()
12701274
12711275 return (imgs ,
12721276 jsons ,
@@ -1398,7 +1402,7 @@ def bids_ignore(out_dir: str) -> str:
13981402 # Write to file using File class context manager
13991403 with File (new_file ) as f :
14001404 f .write_txt (".misc \n " )
1401- f .write_txt ("unknown \n " )
1405+ f .write_txt ("unknown/* \n " )
14021406
14031407 return new_file
14041408
0 commit comments