Skip to content

Commit 5edda67

Browse files
committed
Fixed GLM filtering
1 parent 89d9ad0 commit 5edda67

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

picachooser/scripts/PICAchooser.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def decrementgrade(whichcomponent):
269269

270270

271271
def filterdata(glmtype=None):
272-
denoisingcmd = makefiltercommand()
272+
denoisingcmd = makefiltercommand(debug=False)
273273
if denoisingcmd is not None:
274274
if glmtype is None:
275275
print()
@@ -297,11 +297,17 @@ def makegradelists():
297297
return badlist, goodlist
298298

299299

300-
def makefiltercommand():
300+
def makefiltercommand(debug=False):
301301
global Funcfile, Mixfile, filteredfile, config
302302

303303
badlist, dummy = makegradelists()
304304

305+
if debug:
306+
print("makefiltercommand:")
307+
print(f"\t{badlist=}")
308+
print(f"\t{filteredfile=}")
309+
print(f"\t{config['usebatch']=}")
310+
305311
# Non-aggressive denoising of the data using fsl_regfilt (partial regression), if requested
306312
if filteredfile is not None:
307313
if config["usebatch"]:
@@ -335,6 +341,8 @@ def makefiltercommand():
335341
os.path.abspath(Funcfile),
336342
os.path.abspath(filteredfile),
337343
]
344+
if debug:
345+
print("denoising command: ", " ".join(denoisingcmd))
338346
return denoisingcmd
339347
else:
340348
print("no filtered file")
@@ -356,7 +364,7 @@ def writegrades():
356364
with open(outputfile, "w") as thefile:
357365
thefile.write(outputstring + "\n")
358366

359-
denoisingcmd = makefiltercommand()
367+
denoisingcmd = makefiltercommand(debug=False)
360368
if denoisingcmd is not None:
361369
print(" ".join(denoisingcmd))
362370

@@ -1220,7 +1228,14 @@ def main():
12201228
)
12211229
sys.exit()
12221230

1223-
filteredfile = args.filteredfile
1231+
if args.filteredfile is not None:
1232+
filteredfile = args.filteredfile
1233+
else:
1234+
if runmode != "groupmelodic":
1235+
FuncfileDir, FuncfileName = os.path.split(os.path.abspath(Funcfile))
1236+
filteredfile = os.path.join(FuncfileDir, "filtered_func_data_picachooserglm.nii.gz")
1237+
else:
1238+
Funcfile = None
12241239

12251240
if verbose:
12261241
print(f"ICfile: {ICfile}")

0 commit comments

Comments
 (0)