Skip to content

Commit

Permalink
Fix a number of issues when running standalone script with missing ou…
Browse files Browse the repository at this point in the history
…tput data
  • Loading branch information
mcraig-ibme committed Nov 11, 2024
1 parent 7feab0a commit f571006
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions oxasl/region_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,10 @@ def run(wsp):
add_roi(wsp, rois, "%i%%+WM" % (wsp.min_wm_thresh*100), wsp.structural.wm_pv_asl, wsp.min_wm_thresh)
add_roi(wsp, rois, "%i%%+GM" % (wsp.pure_gm_thresh*100), wsp.structural.gm_pv_asl, wsp.pure_gm_thresh)
add_roi(wsp, rois, "%i%%+WM" % (wsp.pure_wm_thresh*100), wsp.structural.wm_pv_asl, wsp.pure_wm_thresh)
add_roi(wsp, rois, "Cortical %i%%+GM" % (wsp.pure_gm_thresh*100), wsp.rois.cortical_gm_asl)
add_roi(wsp, rois, "Cerebral %i%%+WM" % (wsp.pure_wm_thresh*100), wsp.rois.cerebral_wm_asl)
if wsp.rois.cortical_gm_asl is not None:
add_roi(wsp, rois, "Cortical %i%%+GM" % (wsp.pure_gm_thresh*100), wsp.rois.cortical_gm_asl)
if wsp.rois.cerebral_wm_asl is not None:
add_roi(wsp, rois, "Cerebral %i%%+WM" % (wsp.pure_wm_thresh*100), wsp.rois.cerebral_wm_asl)

wsp.log.write("\nLoading tissue PV ROI set")
roi_set = Image(np.stack([wsp.structural.gm_pv_asl.data, wsp.structural.wm_pv_asl.data, wsp.structural.csf_pv_asl.data], axis=-1), header=wsp.structural.csf_pv_asl.header)
Expand Down Expand Up @@ -776,10 +778,10 @@ def main():
wsp.full_region_analysis = True

copy = {
"reg" : ["aslref", "strucref", "stdref", "asl2struc.mat",
"struc2std", "struc2asl.mat", "std2struc"],
"reg" : ["nativeref", "aslref", "strucref", "stdref", "asl2struc.mat",
"struc2std", "struc2std.mat", "struc2asl.mat", "std2struc", "std2struc.mat"],
"rois" : ["cortical_gm_asl", "cerebral_wm_asl"],
"structural" : ["struc"],
"structural" : ["struc", "gm_pv_asl", "gm_pv", "wm_pv_asl", "wm_pv", "csf_pv_asl", "csf_pv"],
"calibration" : []
}

Expand All @@ -790,13 +792,15 @@ def main():
if fname.endswith(".mat"):
obj = np.loadtxt(fpath)
else:
obj = Image(fpath)
try:
obj = Image(fpath)
except:
continue # Essential missing data will generate error later
attr = fname[:fname.index(".")] if "." in fname else fname
setattr(subwsp, attr, obj)

wsp.pvgm = Image(os.path.join(options.oxasl_dir, "structural", "gm_pv_asl"))
wsp.pvwm = Image(os.path.join(options.oxasl_dir, "structural", "wm_pv_asl"))
wsp.pvcsf = Image(os.path.join(options.oxasl_dir, "structural", "csf_pv_asl"))
if wsp.reg.aslref is None and wsp.reg.nativeref is not None:
wsp.reg.aslref = wsp.reg.nativeref
wsp.calibration.calib_method = [""]

run(wsp)
Expand Down

0 comments on commit f571006

Please sign in to comment.