From f9cbc0ad695d60a81f77861ae7f9883af0c72f46 Mon Sep 17 00:00:00 2001 From: Wenrui Li Date: Tue, 7 Mar 2023 19:42:24 -0500 Subject: [PATCH 1/3] Fixed #1 empty sod list. --- pysaber/mainsr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pysaber/mainsr.py b/pysaber/mainsr.py index 2f12371..dd43c17 100644 --- a/pysaber/mainsr.py +++ b/pysaber/mainsr.py @@ -86,7 +86,7 @@ def estimate_blur(rads,sod,odd,pix_wid,edge,thresh=1e-6,pad=[3,3],masks=None,bda trans_bounds_det.append(trans_bounds[i]) sod_det.append(sod[i]) sdd_det.append(sdd[i]) - elif sod[i] > sod_avg and not only_src: + elif sod[i] >= sod_avg and not only_src: rads_det.append(rads[i]) trans_models_det.append(trans_models[i]) trans_params_det.append(trans_params[i]) From 5abe3d0ab9b833ba70cad5f7ec5f519d065d6616 Mon Sep 17 00:00:00 2001 From: Wenrui Li Date: Tue, 7 Mar 2023 21:01:49 -0500 Subject: [PATCH 2/3] Update mainsr.py --- pysaber/mainsr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pysaber/mainsr.py b/pysaber/mainsr.py index dd43c17..b6008e3 100644 --- a/pysaber/mainsr.py +++ b/pysaber/mainsr.py @@ -117,7 +117,7 @@ def estimate_blur(rads,sod,odd,pix_wid,edge,thresh=1e-6,pad=[3,3],masks=None,bda trans_bounds_src.append(trans_bounds[i]) sod_src.append(sod[i]) sdd_src.append(sdd[i]) - elif sod[i] < sod_avg and not only_det: + elif sod[i] <= sod_avg and not only_det: rads_src.append(rads[i]) trans_models_src.append(trans_models[i]) trans_params_src.append(trans_params[i]) From 44a8969e5212141cb1bafb7ed29ebe721d617a1f Mon Sep 17 00:00:00 2001 From: Wenrui Li Date: Wed, 15 Mar 2023 01:27:57 -0400 Subject: [PATCH 3/3] Update mainsr.py --- pysaber/mainsr.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pysaber/mainsr.py b/pysaber/mainsr.py index b6008e3..bd5149f 100644 --- a/pysaber/mainsr.py +++ b/pysaber/mainsr.py @@ -74,9 +74,9 @@ def estimate_blur(rads,sod,odd,pix_wid,edge,thresh=1e-6,pad=[3,3],masks=None,bda #It is recommended to run the blur model estimation in multiple stages #First, only estimate the detector blur using radiographs with the largest SODs #Radiographs with the largest SODs are expected to have minimal source blur - sod_avg = sum(sod)/len(sod) #Compute average of all SODs + sod_odd_avg_quotient = sum(np.array(sod)/np.array(odd))/len(sod) #Compute average of all SODs/ODDs - #Only include list elements with SOD > average of all SODs + #Only include list elements with SOD/ODD > average of all SODs/ODDs rads_det,trans_models_det,trans_params_det,trans_bounds_det,sod_det,sdd_det = [],[],[],[],[],[] for i in range(len(rads)): if only_det: @@ -86,7 +86,7 @@ def estimate_blur(rads,sod,odd,pix_wid,edge,thresh=1e-6,pad=[3,3],masks=None,bda trans_bounds_det.append(trans_bounds[i]) sod_det.append(sod[i]) sdd_det.append(sdd[i]) - elif sod[i] >= sod_avg and not only_src: + elif sod[i]/odd[i] > sod_odd_avg_quotient and not only_src: rads_det.append(rads[i]) trans_models_det.append(trans_models[i]) trans_params_det.append(trans_params[i]) @@ -107,7 +107,7 @@ def estimate_blur(rads,sod,odd,pix_wid,edge,thresh=1e-6,pad=[3,3],masks=None,bda print("{:.2f} mins has elapsed".format((time.time()-start_time)/60.0)) #Next, only estimate the source blur using radiographs at the smallest source to object distances - #Only include list elements with SOD < average of all SODs + #Only include list elements with SOD/ODD < average of all SODs/ODDs rads_src,trans_models_src,trans_params_src,trans_bounds_src,sod_src,sdd_src = [],[],[],[],[],[] for i in range(len(rads)): if only_src: @@ -117,7 +117,7 @@ def estimate_blur(rads,sod,odd,pix_wid,edge,thresh=1e-6,pad=[3,3],masks=None,bda trans_bounds_src.append(trans_bounds[i]) sod_src.append(sod[i]) sdd_src.append(sdd[i]) - elif sod[i] <= sod_avg and not only_det: + elif sod[i]/odd[i] < sod_odd_avg_quotient and not only_det: rads_src.append(rads[i]) trans_models_src.append(trans_models[i]) trans_params_src.append(trans_params[i])