@@ -1223,12 +1223,18 @@ def find_file(base, subfolder, suffix, desc):
12231223 cmd .extend (["--dwi-file" , os .path .abspath (dwi )])
12241224 cmd .extend (["--bval-file" , os .path .abspath (bval_file )])
12251225 cmd .extend (["--bvec-file" , os .path .abspath (bvec_file )])
1226+ else :
1227+ # FIX: Explicitly pass empty strings to clear potential cache/defaults in pipeline
1228+ cmd .extend (["--dwi-file" , "" ])
1229+ cmd .extend (["--bval-file" , "" ])
1230+ cmd .extend (["--bvec-file" , "" ])
12261231
12271232 if inv_dwi :
12281233 cmd .extend (["--inverse-dwi-file" , os .path .abspath (inv_dwi )])
1229- if inv_bval_file :
1230- cmd .extend (["--inverse-bval-file" , os .path .abspath (inv_bval_file )])
1231- cmd .extend (["--inverse-bvec-file" , os .path .abspath (inv_bvec_file )])
1234+ cmd .extend (["--inverse-bval-file" , os .path .abspath (inv_bval_file ) if inv_bval_file else "" ])
1235+ cmd .extend (["--inverse-bvec-file" , os .path .abspath (inv_bvec_file ) if inv_bvec_file else "" ])
1236+ else :
1237+ cmd .extend (["--inverse-dwi-file" , "" ])
12321238
12331239 # Passthrough args
12341240 if args .gpu : cmd .append ("--gpu" )
@@ -1243,6 +1249,10 @@ def find_file(base, subfolder, suffix, desc):
12431249 cmd .extend (["--PED" , args .PED ])
12441250 cmd .extend (["--shell-dimension" , str (args .shell_dimension )])
12451251
1252+ # FIX: Pass unknown arguments (like --unlock, --rerun-incomplete) to the pipeline
1253+ if unknown :
1254+ cmd .extend (unknown )
1255+
12461256 # 6. Execute and Log
12471257 print (f"{ Fore .CYAN } Launching pipeline for { sub_ses_str } ...{ Style .RESET_ALL } " )
12481258
@@ -1284,7 +1294,8 @@ def find_file(base, subfolder, suffix, desc):
12841294 "bval" : bval_file ,
12851295 "bvec" : bvec_file ,
12861296 "inverse_dwi" : inv_dwi ,
1287- "inverse_bval" : inv_bval_file
1297+ "inverse_bval" : inv_bval_file ,
1298+ "inverse_bvec" : inv_bvec_file
12881299 },
12891300 "config" : {
12901301 "linear" : args .linear ,
@@ -1359,8 +1370,10 @@ def find_file(base, subfolder, suffix, desc):
13591370 "linear" ,
13601371 "nonlinear"
13611372 ]:
1362- if getattr (args , param .replace ("-" , "_" ), None ):
1363- config [param ] = getattr (args , param .replace ("-" , "_" ))
1373+ # FIX: Check if argument is strictly not None (allow empty strings to override cache)
1374+ val = getattr (args , param .replace ("-" , "_" ), None )
1375+ if val is not None :
1376+ config [param ] = val
13641377
13651378 # Add config parameters to command
13661379 if len (config ) > 0 :
@@ -1694,6 +1707,8 @@ def find_file(base, subfolder, suffix, desc):
16941707 sdc_args .append (f"--{ arg_name_formatted } " )
16951708 sdc_args .append (str (arg_value ))
16961709
1710+
1711+
16971712 # Run the SDC script
16981713 try :
16991714 print (f"Running susceptibility distortion correction on { args .input } ..." )
0 commit comments