Thu, 25 Apr 2024 11:16:24 -0500
Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Manifest.toml | file | annotate | diff | comparison | revisions | |
Project.toml | file | annotate | diff | comparison | revisions | |
src/PET/PET.jl | file | annotate | diff | comparison | revisions | |
src/PlotResults.jl | file | annotate | diff | comparison | revisions | |
src/PredictPDPS.jl | file | annotate | diff | comparison | revisions | |
src/Stats.jl | file | annotate | diff | comparison | revisions |
--- a/Manifest.toml Thu Apr 25 11:08:03 2024 -0500 +++ b/Manifest.toml Thu Apr 25 11:16:24 2024 -0500 @@ -25,7 +25,7 @@ deps = ["DelimitedFiles", "Printf"] path = "../AlgTools" uuid = "c46e2e78-5339-41fd-a966-983ff60ab8e7" -version = "0.1.0" +version = "0.1.1" [[ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" @@ -40,12 +40,6 @@ [[Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" -[[AssetRegistry]] -deps = ["Distributed", "JSON", "Pidfile", "SHA", "Test"] -git-tree-sha1 = "b25e88db7944f98789130d7b503276bc34bc098e" -uuid = "bf4720bc-e11a-5d0c-854e-bdca1663c893" -version = "0.1.0" - [[AxisAlgorithms]] deps = ["LinearAlgebra", "Random", "SparseArrays", "WoodburyMatrices"] git-tree-sha1 = "66771c8d21c8ff5e3a93379480a2307ac36863f7" @@ -66,12 +60,6 @@ uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35" version = "0.1.8" -[[Blink]] -deps = ["Base64", "Distributed", "HTTP", "JSExpr", "JSON", "Lazy", "Logging", "MacroTools", "Mustache", "Mux", "Pkg", "Reexport", "Sockets", "WebIO"] -git-tree-sha1 = "bc93511973d1f949d45b0ea17878e6cb0ad484a1" -uuid = "ad839575-38b3-5650-b840-f874b8c74a25" -version = "0.12.9" - [[BufferedStreams]] git-tree-sha1 = "4ae47f9a4b1dc19897d3743ff13685925c5202ec" uuid = "e1450e63-4bb3-523b-b2a4-4ffa8c0fd77d" @@ -287,12 +275,6 @@ uuid = "2e619515-83b5-522b-bb60-26c02a35a201" version = "2.5.0+0" -[[EzXML]] -deps = ["Printf", "XML2_jll"] -git-tree-sha1 = "380053d61bb9064d6aa4a9777413b40429c79901" -uuid = "8f5d6c58-4d21-5cfd-889c-e3ad7ee6a615" -version = "1.2.0" - [[FFMPEG_jll]] deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "JLLWrappers", "LAME_jll", "Libdl", "Ogg_jll", "OpenSSL_jll", "Opus_jll", "PCRE2_jll", "Zlib_jll", "libaom_jll", "libass_jll", "libfdk_aac_jll", "libvorbis_jll", "x264_jll", "x265_jll"] git-tree-sha1 = "ab3f7e1819dba9434a3a5126510c8fda3a4e7000" @@ -356,12 +338,6 @@ uuid = "559328eb-81f9-559d-9380-de523a88c83c" version = "1.0.10+0" -[[FunctionalCollections]] -deps = ["Test"] -git-tree-sha1 = "04cb9cfaa6ba5311973994fe3496ddec19b6292a" -uuid = "de31a74c-ac4f-5751-b3fd-e18cd04993ca" -version = "0.5.0" - [[Future]] deps = ["Random"] uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" @@ -450,12 +426,6 @@ uuid = "2e76f6c2-a576-52d4-95c1-20adfe4de566" version = "2.8.1+1" -[[Hiccup]] -deps = ["MacroTools", "Test"] -git-tree-sha1 = "6187bb2d5fcbb2007c39e7ac53308b0d371124bd" -uuid = "9fb69e20-1954-56bb-a84f-559cc56a8ff7" -version = "0.2.2" - [[Hwloc_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] git-tree-sha1 = "ca0f6bf568b4bfc807e7537f081c81e35ceca114" @@ -547,10 +517,10 @@ version = "0.3.8" [[ImageTools]] -deps = ["AlgTools", "ColorTypes", "FileIO", "GR", "OffsetArrays", "Printf", "Setfield"] +deps = ["AlgTools", "ColorTypes", "ColorVectorSpace", "FileIO", "GR", "OffsetArrays", "Printf", "Setfield", "TestImages"] path = "../ImageTools" uuid = "b548cc0d-4ade-417e-bf62-0e39f9d2eee9" -version = "0.1.0" +version = "0.1.1" [[ImageTransformations]] deps = ["AxisAlgorithms", "ColorVectorSpace", "CoordinateTransformations", "ImageBase", "ImageCore", "Interpolations", "OffsetArrays", "Rotations", "StaticArrays"] @@ -655,12 +625,6 @@ uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" version = "1.5.0" -[[JSExpr]] -deps = ["JSON", "MacroTools", "Observables", "WebIO"] -git-tree-sha1 = "b413a73785b98474d8af24fd4c8a975e31df3658" -uuid = "97c1335a-c9c5-57fe-bc5d-ec35cebe8660" -version = "0.5.4" - [[JSON]] deps = ["Dates", "Mmap", "Parsers", "Unicode"] git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a" @@ -679,12 +643,6 @@ uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8" version = "3.0.2+0" -[[Kaleido_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "43032da5832754f58d14a91ffbe86d5f176acda9" -uuid = "f7e6163d-2fa5-5f23-b69c-1db539e41963" -version = "0.2.1+0" - [[LAME_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] git-tree-sha1 = "f6250b16881adf048549549fba48b1161acdac8c" @@ -714,12 +672,6 @@ uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" version = "1.3.1" -[[Lazy]] -deps = ["MacroTools"] -git-tree-sha1 = "1370f8202dac30758f3c345f9909b97f53d87d3f" -uuid = "50d2b5c4-7a5e-59d5-8109-a42b560f39c0" -version = "0.15.1" - [[LazyArtifacts]] deps = ["Artifacts", "Pkg"] uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" @@ -732,12 +684,12 @@ [[LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" -version = "0.6.4" +version = "0.6.3" [[LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.4.0+0" +version = "7.84.0+0" [[LibGit2]] deps = ["Base64", "NetworkOptions", "Printf", "SHA"] @@ -746,7 +698,7 @@ [[LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" -version = "1.11.0+1" +version = "1.10.2+0" [[Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" @@ -921,18 +873,6 @@ uuid = "14a3606d-f60d-562e-9121-12d972cd8159" version = "2022.10.11" -[[Mustache]] -deps = ["Printf", "Tables"] -git-tree-sha1 = "a7cefa21a2ff993bff0456bf7521f46fc077ddf1" -uuid = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70" -version = "1.0.19" - -[[Mux]] -deps = ["AssetRegistry", "Base64", "HTTP", "Hiccup", "MbedTLS", "Pkg", "Sockets"] -git-tree-sha1 = "7295d849103ac4fcbe3b2e439f229c5cc77b9b69" -uuid = "a975b10e-0019-58db-a62f-e48ff68538c9" -version = "1.0.2" - [[NaNMath]] deps = ["OpenLibm_jll"] git-tree-sha1 = "0877504529a3e5c3343c6f8b4c0381e57e4387e4" @@ -955,11 +895,6 @@ uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" version = "1.2.0" -[[Observables]] -git-tree-sha1 = "7438a59546cf62428fc9d1bc94729146d37a7225" -uuid = "510215fc-4207-5dde-b226-833fc4488ee2" -version = "0.5.5" - [[OffsetArrays]] git-tree-sha1 = "e64b4f5ea6b7389f6f046d13d4896a8f9c1ba71e" uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" @@ -1073,12 +1008,6 @@ uuid = "54e51dfa-9dd7-5231-aa84-a4037b83483a" version = "0.3.6" -[[Pidfile]] -deps = ["FileWatching", "Test"] -git-tree-sha1 = "2d8aaf8ee10df53d0dfb9b8ee44ae7c04ced2b03" -uuid = "fa939f87-e72e-5be4-a000-7fc836dbe307" -version = "1.3.0" - [[Pixman_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LLVMOpenMP_jll", "Libdl"] git-tree-sha1 = "64779bc4c9784fee475689a1752ef4d5747c5e87" @@ -1096,36 +1025,6 @@ uuid = "eebad327-c553-4316-9ea0-9fa01ccd7688" version = "0.3.3" -[[PlotlyBase]] -deps = ["ColorSchemes", "Dates", "DelimitedFiles", "DocStringExtensions", "JSON", "LaTeXStrings", "Logging", "Parameters", "Pkg", "REPL", "Requires", "Statistics", "UUIDs"] -git-tree-sha1 = "56baf69781fc5e61607c3e46227ab17f7040ffa2" -uuid = "a03496cd-edff-5a9b-9e67-9cda94a718b5" -version = "0.8.19" - -[[PlotlyJS]] -deps = ["Base64", "Blink", "DelimitedFiles", "JSExpr", "JSON", "Kaleido_jll", "Markdown", "Pkg", "PlotlyBase", "PlotlyKaleido", "REPL", "Reexport", "Requires", "WebIO"] -git-tree-sha1 = "e62d886d33b81c371c9d4e2f70663c0637f19459" -uuid = "f0f68f2c-4968-5e81-91da-67840de0976a" -version = "0.18.13" - - [PlotlyJS.extensions] - CSVExt = "CSV" - DataFramesExt = ["DataFrames", "CSV"] - IJuliaExt = "IJulia" - JSON3Ext = "JSON3" - - [PlotlyJS.weakdeps] - CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" - DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" - IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" - JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" - -[[PlotlyKaleido]] -deps = ["Base64", "JSON", "Kaleido_jll"] -git-tree-sha1 = "2650cd8fb83f73394996d507b3411a7316f6f184" -uuid = "f2990250-8cf9-495f-b13a-cce12b45703c" -version = "2.2.4" - [[PoissonRandom]] deps = ["Random"] git-tree-sha1 = "a0f1159c33f846aa77c3f30ebbc69795e5327152" @@ -1496,24 +1395,6 @@ uuid = "ea10d353-3f73-51f8-a26c-33c1cb351aa5" version = "1.4.2" -[[WebIO]] -deps = ["AssetRegistry", "Base64", "Distributed", "FunctionalCollections", "JSON", "Logging", "Observables", "Pkg", "Random", "Requires", "Sockets", "UUIDs", "WebSockets", "Widgets"] -git-tree-sha1 = "0eef0765186f7452e52236fa42ca8c9b3c11c6e3" -uuid = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29" -version = "0.8.21" - -[[WebSockets]] -deps = ["Base64", "Dates", "HTTP", "Logging", "Sockets"] -git-tree-sha1 = "4162e95e05e79922e44b9952ccbc262832e4ad07" -uuid = "104b5d7c-a370-577a-8038-80a2059c5097" -version = "1.6.0" - -[[Widgets]] -deps = ["Colors", "Dates", "Observables", "OrderedCollections"] -git-tree-sha1 = "fcdae142c1cfc7d89de2d11e08721d0f2f86c98a" -uuid = "cc8bc4a8-27d6-5769-a93b-9d913e69aa62" -version = "0.6.6" - [[WoodburyMatrices]] deps = ["LinearAlgebra", "SparseArrays"] git-tree-sha1 = "5f24e158cf4cee437052371455fe361f526da062" @@ -1525,12 +1406,6 @@ uuid = "76eceee3-57b5-4d4a-8e66-0e911cebbf60" version = "1.6.1" -[[XLSX]] -deps = ["Artifacts", "Dates", "EzXML", "Printf", "Tables", "ZipFile"] -git-tree-sha1 = "319b05e790046f18f12b8eae542546518ef1a88f" -uuid = "fdbf4ff8-1666-58a4-91e7-1b58723a45e0" -version = "0.10.1" - [[XML2_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Zlib_jll"] git-tree-sha1 = "532e22cf7be8462035d092ff21fada7527e2c488" @@ -1693,12 +1568,6 @@ uuid = "c5fb5394-a638-5e4d-96e5-b29de1b5cf10" version = "1.5.0+0" -[[ZipFile]] -deps = ["Libdl", "Printf", "Zlib_jll"] -git-tree-sha1 = "f492b7fe1698e623024e873244f10d89c95c340a" -uuid = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea" -version = "0.10.1" - [[Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" @@ -1790,7 +1659,7 @@ [[nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.52.0+1" +version = "1.48.0+0" [[oneTBB_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"]
--- a/Project.toml Thu Apr 25 11:08:03 2024 -0500 +++ b/Project.toml Thu Apr 25 11:16:24 2024 -0500 @@ -22,7 +22,6 @@ MAT = "23992714-dd62-5051-b70f-ba57cb901cac" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" PerceptualColourMaps = "54e51dfa-9dd7-5231-aa84-a4037b83483a" -PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a" PoissonRandom = "e409e4f3-bfea-5376-8464-e040bb5c01ab" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" QuartzImageIO = "dca85d43-d64c-5e67-8c65-017450d5d020" @@ -32,4 +31,3 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990" -XLSX = "fdbf4ff8-1666-58a4-91e7-1b58723a45e0"
--- a/src/PET/PET.jl Thu Apr 25 11:08:03 2024 -0500 +++ b/src/PET/PET.jl Thu Apr 25 11:16:24 2024 -0500 @@ -37,7 +37,7 @@ include("AlgorithmProximal.jl") include("AlgorithmRotation.jl") include("AlgorithmZeroDual.jl") -include("PlotResults.jl") +#include("PlotResults.jl") import .AlgorithmDualScaling import .AlgorithmGreedy @@ -50,7 +50,7 @@ using .Radon: backproject! using .ImGenerate using .OpticalFlow: DisplacementFull, DisplacementConstant -using .PlotResults +#using .PlotResults ############## @@ -61,8 +61,8 @@ demo_petS4, demo_petS5, demo_petS6, demo_petS7, demo_petB1, demo_petB2, demo_petB3, demo_petB4, demo_petB5, demo_petB6, demo_petB7, - batchrun_shepplogan, batchrun_brainphantom, batchrun_pet, - plot_pet + batchrun_shepplogan, batchrun_brainphantom, batchrun_pet + #plot_pet ################################### # Parameterisation and experiments @@ -557,14 +557,14 @@ # Plotting SSIM and PSNR ######################### -function plot_pet(kwargs...) - ssim_plot("shepplogan") - psnr_plot("shepplogan") - fv_plot("shepplogan") - ssim_plot("brainphantom") - psnr_plot("brainphantom") - fv_plot("brainphantom") -end +#function plot_pet(kwargs...) +# ssim_plot("shepplogan") +# psnr_plot("shepplogan") +# fv_plot("shepplogan") +# ssim_plot("brainphantom") +# psnr_plot("brainphantom") +# fv_plot("brainphantom") +#end ###############
--- a/src/PlotResults.jl Thu Apr 25 11:08:03 2024 -0500 +++ b/src/PlotResults.jl Thu Apr 25 11:16:24 2024 -0500 @@ -1,5 +1,3 @@ -__precompile__() - module PlotResults @@ -7,13 +5,12 @@ # Load external modules ######################## -using DelimitedFiles, CSV, DataFrames +using CSV, DataFrames using PlotlyJS using Colors -using XLSX: writetable using Statistics -export fv_plot, ssim_plot, psnr_plot, calculate_statistics +export fv_plot, ssim_plot, psnr_plot global mystart = 38 global myend = 135 @@ -656,66 +653,4 @@ end -function calculate_statistics() - ImName = ("lighthouse200x300", "shepplogan256x256", "brainphantom256x256") - AlgName = ("dualscaling", "greedy","noprediction","primalonly","proximal","rotation","zerodual") - mystart = 41 # Corresponds to the 500th iterate - - # Define an array to store results - results = DataFrame(experiment = String[], α = Float64[], algorithm = String[], psnr_mean1 = Float64[], psnr_mean500 = Float64[], psnr_ci = String[], ssim_mean1 = Float64[], ssim_mean500 = Float64[], ssim_ci = String[]) - - for imname in ImName - for algname in AlgName - directory_path = "./img/" - files = readdir(directory_path) - filtered_files = filter(file -> startswith(file, "$(imname)_pdps_known_$(algname)") && endswith(file, ".txt"), files) - - for file in filtered_files - filename = directory_path * file - data = CSV.File(filename, delim='\t', header=2) |> DataFrame - - # Extract α from filename - α, _, _ = extract_parameters(filename) - - - # Extract SSIM and PSNR columns starting from 1st iteration - ssim_values1 = Float64.(data[:, :ssim]) - psnr_values1 = Float64.(data[:, :psnr]) - - # Extract SSIM and PSNR columns starting from 500th iteration - ssim_values500 = Float64.(data[mystart:end, :ssim]) - psnr_values500 = Float64.(data[mystart:end, :psnr]) - - # Calculate mean and confidence intervals - ssim_mean1 = round(mean(ssim_values1), digits=4) - psnr_mean1 = round(mean(psnr_values1), digits=4) - - ssim_mean500 = round(mean(ssim_values500), digits=4) - psnr_mean500 = round(mean(psnr_values500), digits=4) - ssim_std500 = round(std(ssim_values500), digits=4) - psnr_std500 = round(std(psnr_values500), digits=4) - n = length(ssim_values500) - - ssim_ci_lower = round(ssim_mean500 - 1.96 * ssim_std500 / sqrt(n), digits=4) - ssim_ci_upper = round(ssim_mean500 + 1.96 * ssim_std500 / sqrt(n), digits=4) - psnr_ci_lower = round(psnr_mean500 - 1.96 * psnr_std500 / sqrt(n), digits=4) - psnr_ci_upper = round(psnr_mean500 + 1.96 * psnr_std500 / sqrt(n), digits=4) - - ssim_ci = "$(ssim_ci_lower) - $(ssim_ci_upper)" - psnr_ci = "$(psnr_ci_lower) - $(psnr_ci_upper)" - experiment = "$(imname)" - algorithm = "$(algname)" - - # Append results to DataFrame - push!(results, (experiment, α, algorithm, psnr_mean1, psnr_mean500, psnr_ci, ssim_mean1, ssim_mean500, ssim_ci)) - end - end - end - sort!(results, [:experiment, :α]) - excel_path = "./img/summarystats.xlsx" - if isfile(excel_path) - rm(excel_path) - end - writetable(excel_path, sheetname="Experiments", results) -end end # Module \ No newline at end of file
--- a/src/PredictPDPS.jl Thu Apr 25 11:08:03 2024 -0500 +++ b/src/PredictPDPS.jl Thu Apr 25 11:16:24 2024 -0500 @@ -22,7 +22,7 @@ using AlgTools.StructTools using AlgTools.LinkedLists using AlgTools.Comms -using ImageTools.Visualise: secs_ns, grayimg, do_visualise +using ImageTools.Visualise: secs_ns, grayimg, do_visualise using ImageTools.ImFilter: gaussian ##################### @@ -40,7 +40,8 @@ include("AlgorithmBothNL.jl") include("AlgorithmFB.jl") include("AlgorithmFBDual.jl") -include("PlotResults.jl") +include("Stats.jl") +#include("PlotResults.jl") # Additional @@ -72,7 +73,8 @@ using .ImGenerate using .OpticalFlow: DisplacementFull, DisplacementConstant -using .PlotResults +using .Stats +#using .PlotResults using .PET ############## @@ -85,14 +87,15 @@ demo_unknown1,demo_unknown2,demo_unknown3, batchrun_denoising, batchrun_predictors, - demo_denoising1, demo_denoising2, demo_denoising3, + demo_denoising1, demo_denoising2, demo_denoising3, demo_denoising4, demo_denoising5, demo_denoising6, demo_denoising7, - demo_petS1, demo_petS2, demo_petS3, + demo_petS1, demo_petS2, demo_petS3, demo_petS4, demo_petS5, demo_petS6, demo_petS7, - demo_petB1, demo_petB2, demo_petB3, + demo_petB1, demo_petB2, demo_petB3, demo_petB4, demo_petB5, demo_petB6, demo_petB7, batchrun_shepplogan, batchrun_brainphantom, batchrun_pet, - plot_denoising, plot_pet, calculate_statistics + calculate_statistics + #plot_denoising, plot_pet, ################################### # Parameterisation and experiments @@ -218,17 +221,17 @@ Experiment(AlgorithmDualScaling, DisplacementConstant, lighthouse, p_known₀_denoising), Experiment(AlgorithmGreedy, DisplacementConstant, lighthouse, - p_known₀_denoising), + p_known₀_denoising), Experiment(AlgorithmNoPrediction, DisplacementConstant, lighthouse, - p_known₀_denoising), + p_known₀_denoising), Experiment(AlgorithmPrimalOnly, DisplacementConstant, lighthouse, - p_known₀_denoising), + p_known₀_denoising), Experiment(AlgorithmProximal, DisplacementConstant, lighthouse, p_known₀_denoising ⬿ (phantom_ρ = 100,)), Experiment(AlgorithmRotation, DisplacementConstant, lighthouse, p_known₀_denoising), Experiment(AlgorithmZeroDual, DisplacementConstant, lighthouse, - p_known₀_denoising), + p_known₀_denoising), ) const denoising_experiments_all = Iterators.flatten(( @@ -302,7 +305,7 @@ wp("sigma", (e_params.σ₀ == 1 ? "" : "$(e_params.σ₀)") * "\\sigma_{\\max}") end end -end +end function run_experiments(;visualise=true, recalculate=true, @@ -458,7 +461,7 @@ d = take!(datachannel) - for iter=1:params.maxiter + for iter=1:params.maxiter dnext = take!(datachannel) st = step(d.b_noisy, d.v, dnext.b_noisy) do calc_objective stn = st @@ -484,7 +487,7 @@ entry = LogEntry(iter, tm, value, #sc*d.v_cumul_true[1], #sc*d.v_cumul_true[2], - #sc*v[1], sc*v[2], + #sc*v[1], sc*v[2], assess_psnr(x, d.b_true), assess_ssim(x, d.b_true), #assess_psnr(d.b_noisy, d.b_true), @@ -585,7 +588,7 @@ GR.polyline(x, y) end end - GR.updatews() + GR.updatews() end end @@ -593,11 +596,11 @@ # Plotting SSIM and PSNR ######################### -function plot_denoising(kwargs...) - ssim_plot("lighthouse") - psnr_plot("lighthouse") - fv_plot("lighthouse") -end +#function plot_denoising(kwargs...) +# ssim_plot("lighthouse") +# psnr_plot("lighthouse") +# fv_plot("lighthouse") +#end ###############
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Stats.jl Thu Apr 25 11:16:24 2024 -0500 @@ -0,0 +1,78 @@ +__precompile__() + +module Stats + + +######################## +# Load external modules +######################## + +using CSV, DataFrames +using Statistics + +export calculate_statistics + +function calculate_statistics() + ImName = ("lighthouse200x300", "shepplogan256x256", "brainphantom256x256") + AlgName = ("dualscaling", "greedy","noprediction","primalonly","proximal","rotation","zerodual") + mystart = 41 # Corresponds to the 500th iterate + + # Define an array to store results + results = DataFrame(experiment = String[], α = Float64[], algorithm = String[], psnr_mean1 = Float64[], psnr_mean500 = Float64[], psnr_ci = String[], ssim_mean1 = Float64[], ssim_mean500 = Float64[], ssim_ci = String[]) + + for imname in ImName + for algname in AlgName + directory_path = "./img/" + files = readdir(directory_path) + filtered_files = filter(file -> startswith(file, "$(imname)_pdps_known_$(algname)") && endswith(file, ".txt"), files) + + for file in filtered_files + filename = directory_path * file + data = CSV.File(filename, delim='\t', header=2) |> DataFrame + + # Extract α from filename + α, _, _ = extract_parameters(filename) + + + # Extract SSIM and PSNR columns starting from 1st iteration + ssim_values1 = Float64.(data[:, :ssim]) + psnr_values1 = Float64.(data[:, :psnr]) + + # Extract SSIM and PSNR columns starting from 500th iteration + ssim_values500 = Float64.(data[mystart:end, :ssim]) + psnr_values500 = Float64.(data[mystart:end, :psnr]) + + # Calculate mean and confidence intervals + ssim_mean1 = round(mean(ssim_values1), digits=4) + psnr_mean1 = round(mean(psnr_values1), digits=4) + + ssim_mean500 = round(mean(ssim_values500), digits=4) + psnr_mean500 = round(mean(psnr_values500), digits=4) + ssim_std500 = round(std(ssim_values500), digits=4) + psnr_std500 = round(std(psnr_values500), digits=4) + n = length(ssim_values500) + + ssim_ci_lower = round(ssim_mean500 - 1.96 * ssim_std500 / sqrt(n), digits=4) + ssim_ci_upper = round(ssim_mean500 + 1.96 * ssim_std500 / sqrt(n), digits=4) + psnr_ci_lower = round(psnr_mean500 - 1.96 * psnr_std500 / sqrt(n), digits=4) + psnr_ci_upper = round(psnr_mean500 + 1.96 * psnr_std500 / sqrt(n), digits=4) + + ssim_ci = "$(ssim_ci_lower) - $(ssim_ci_upper)" + psnr_ci = "$(psnr_ci_lower) - $(psnr_ci_upper)" + experiment = "$(imname)" + algorithm = "$(algname)" + + # Append results to DataFrame + push!(results, (experiment, α, algorithm, psnr_mean1, psnr_mean500, psnr_ci, ssim_mean1, ssim_mean500, ssim_ci)) + end + end + end + sort!(results, [:experiment, :α]) + csv_path = "./img/summarystats.csv" + if isfile(csv_path) + rm(csv_path) + end + CSV.write(csv_path, results) +end + +end