# HG changeset patch # User Tuomo Valkonen # Date 1714074534 18000 # Node ID 3e54b2b54029507a7b448db9b688d598722c5fa7 # Parent 2464329e356d07d48ba3d3ca8db4a9cdab8eb3dd oops diff -r 2464329e356d -r 3e54b2b54029 src/PET/PlotResults.jl --- a/src/PET/PlotResults.jl Thu Apr 25 14:25:27 2024 -0500 +++ b/src/PET/PlotResults.jl Thu Apr 25 14:48:54 2024 -0500 @@ -13,6 +13,8 @@ export fv_plot, ssim_plot, psnr_plot +using ...Stats: extract_parameters + global mystart = 38 global myend = 75 diff -r 2464329e356d -r 3e54b2b54029 src/PlotResults.jl --- a/src/PlotResults.jl Thu Apr 25 14:25:27 2024 -0500 +++ b/src/PlotResults.jl Thu Apr 25 14:48:54 2024 -0500 @@ -10,6 +10,8 @@ using Colors using Statistics +using ..Stats: extract_parameters + export fv_plot, ssim_plot, psnr_plot global mystart = 38 @@ -621,36 +623,5 @@ return plot([orig;identity;adhoc;rotation;affine;zerodual],layout) end -###################### -# Parameter extraction -###################### -function extract_parameters(filename :: String) - # Extracting parameters - params_line = readlines(filename)[1] - - # Split the line by commas and trim each part - params_parts = map(strip, split(params_line, ',')) - - # Initialize variables to store parameter values - α_value, τ₀_value, σ₀_value = missing, missing, missing - - # Look for specific substrings to identify the values of α, τ₀, and σ₀ - for param_part in params_parts - if contains(param_part, "α = ") - α_value = parse(Float64, split(param_part, '=')[2]) - elseif contains(param_part, "τ₀ = ") - τ₀_value = parse(Float64, split(param_part, '=')[2]) - elseif contains(param_part, "σ₀ = ") - σ₀_value = parse(Float64, split(param_part, '=')[2]) - end - end - - # Assign the values to α, τ₀, and σ₀ - α = α_value - τ₀ = τ₀_value - σ₀ = σ₀_value - return α, τ₀, σ₀ -end - end # Module \ No newline at end of file diff -r 2464329e356d -r 3e54b2b54029 src/Stats.jl --- a/src/Stats.jl Thu Apr 25 14:25:27 2024 -0500 +++ b/src/Stats.jl Thu Apr 25 14:48:54 2024 -0500 @@ -10,7 +10,36 @@ using CSV, DataFrames using Statistics -export calculate_statistics +export calculate_statistics, + extract_parameters + +function extract_parameters(filename :: String) + # Extracting parameters + params_line = readlines(filename)[1] + + # Split the line by commas and trim each part + params_parts = map(strip, split(params_line, ',')) + + # Initialize variables to store parameter values + α_value, τ₀_value, σ₀_value = missing, missing, missing + + # Look for specific substrings to identify the values of α, τ₀, and σ₀ + for param_part in params_parts + if contains(param_part, "α = ") + α_value = parse(Float64, split(param_part, '=')[2]) + elseif contains(param_part, "τ₀ = ") + τ₀_value = parse(Float64, split(param_part, '=')[2]) + elseif contains(param_part, "σ₀ = ") + σ₀_value = parse(Float64, split(param_part, '=')[2]) + end + end + + # Assign the values to α, τ₀, and σ₀ + α = α_value + τ₀ = τ₀_value + σ₀ = σ₀_value + return α, τ₀, σ₀ +end function calculate_statistics() ImName = ("lighthouse200x300", "shepplogan256x256", "brainphantom256x256")