# HG changeset patch # User Neil Dizon # Date 1713722457 -10800 # Node ID 2d9e64235ba7d34b890754ba70d2f79f7938b77e # Parent 1c4b7d1f261ff4f060958eea47141981897ccce9 renamed generate_radon as generate_sinogram diff -r 1c4b7d1f261f -r 2d9e64235ba7 src/ImGenerate.jl --- a/src/ImGenerate.jl Sun Apr 21 20:42:43 2024 +0300 +++ b/src/ImGenerate.jl Sun Apr 21 21:00:57 2024 +0300 @@ -200,7 +200,7 @@ b_true = zeros(sz...) extract_subimage!(b_true, im, v_cumul; threads=true) b = b_true .+ params.noise_level.*randn(rng,sz...) - v = v_true.*(1.0 .+ params.shake_noise_level.*randn(rng,size(v_true)...)) + v = v_true.*(1.0 .+ zero_factor*params.shake_noise_level.*randn(rng,size(v_true)...)) # Pass data to iteration routine data = OnlineData{DisplacementConstant}(b_true, b, v, v_true, v_cumul) if !put_unless_closed!(datachannel, data) @@ -227,7 +227,7 @@ ######################################################################## # PETscan ######################################################################## -function generate_radon(im, sz, +function generate_sinogram(im, sz, :: Type{DisplacementConstant}, datachannel :: Channel{PetOnlineData{DisplacementConstant}}, params :: NamedTuple) @@ -257,8 +257,8 @@ # Apply the transformation to the image using warp b_true = copy(warp(im, tform, axes(im), fillvalue=Flat())) - v = v_true.*(1.0 .+ params.shake_noise_level.*randn(rng,size(v_true)...)) - theta = theta_true*(1.0 + params.rotation_noise_level.*randn(rng)) + v = v_true.*(1.0 .+ zero_factor*params.shake_noise_level.*randn(rng,size(v_true)...)) + theta = theta_true*(1.0 + zero_factor*params.rotation_noise_level.*randn(rng)) # Generate the true and noisy sinograms sinogram_true = zeros(params.radondims...) @@ -293,14 +293,14 @@ function imgen_shepplogan_radon(sz) im = convert(Array{Float64},TestImages.shepp_logan(sz[1], highContrast=true)) dynrange = maximum(im) - return ImGen(curry(generate_radon, im, sz), sz, 1, dynrange, "shepplogan$(sz[1])x$(sz[2])") + return ImGen(curry(generate_sinogram, im, sz), sz, 1, dynrange, "shepplogan$(sz[1])x$(sz[2])") end function imgen_brainphantom_radon(sz) data = matread("src/PET/phantom_slice.mat") im = normalise(imresize(convert(Array{Float64},data["square_data"]),sz)) dynrange = maximum(im) - return ImGen(curry(generate_radon, im, sz), sz, 1, dynrange, "brainphantom$(sz[1])x$(sz[2])") + return ImGen(curry(generate_sinogram, im, sz), sz, 1, dynrange, "brainphantom$(sz[1])x$(sz[2])") end normalise = (data) -> data./maximum(data) diff -r 1c4b7d1f261f -r 2d9e64235ba7 src/PET/ImGenerate.jl --- a/src/PET/ImGenerate.jl Sun Apr 21 20:42:43 2024 +0300 +++ b/src/PET/ImGenerate.jl Sun Apr 21 21:00:57 2024 +0300 @@ -200,7 +200,7 @@ b_true = zeros(sz...) extract_subimage!(b_true, im, v_cumul; threads=true) b = b_true .+ params.noise_level.*randn(rng,sz...) - v = v_true.*(1.0 .+ params.shake_noise_level.*randn(rng,size(v_true)...)) + v = v_true.*(1.0 .+ zero_factor*params.shake_noise_level.*randn(rng,size(v_true)...)) # Pass data to iteration routine data = OnlineData{DisplacementConstant}(b_true, b, v, v_true, v_cumul) if !put_unless_closed!(datachannel, data) @@ -227,7 +227,7 @@ ######################################################################## # PETscan ######################################################################## -function generate_radon(im, sz, +function generate_sinogram(im, sz, :: Type{DisplacementConstant}, datachannel :: Channel{PetOnlineData{DisplacementConstant}}, params :: NamedTuple) @@ -257,8 +257,8 @@ # Apply the transformation to the image using warp b_true = copy(warp(im, tform, axes(im), fillvalue=Flat())) - v = v_true.*(1.0 .+ params.shake_noise_level.*randn(rng,size(v_true)...)) - theta = theta_true*(1.0 + params.rotation_noise_level.*randn(rng)) + v = v_true.*(1.0 .+ zero_factor*params.shake_noise_level.*randn(rng,size(v_true)...)) + theta = theta_true*(1.0 + zero_factor*params.rotation_noise_level.*randn(rng)) # Generate the true and noisy sinograms sinogram_true = zeros(params.radondims...) @@ -293,14 +293,14 @@ function imgen_shepplogan_radon(sz) im = convert(Array{Float64},TestImages.shepp_logan(sz[1], highContrast=true)) dynrange = maximum(im) - return ImGen(curry(generate_radon, im, sz), sz, 1, dynrange, "shepplogan$(sz[1])x$(sz[2])") + return ImGen(curry(generate_sinogram, im, sz), sz, 1, dynrange, "shepplogan$(sz[1])x$(sz[2])") end function imgen_brainphantom_radon(sz) data = matread("src/PET/phantom_slice.mat") im = normalise(imresize(convert(Array{Float64},data["square_data"]),sz)) dynrange = maximum(im) - return ImGen(curry(generate_radon, im, sz), sz, 1, dynrange, "brainphantom$(sz[1])x$(sz[2])") + return ImGen(curry(generate_sinogram, im, sz), sz, 1, dynrange, "brainphantom$(sz[1])x$(sz[2])") end normalise = (data) -> data./maximum(data) diff -r 1c4b7d1f261f -r 2d9e64235ba7 src/PET/PlotResults.jl --- a/src/PET/PlotResults.jl Sun Apr 21 20:42:43 2024 +0300 +++ b/src/PET/PlotResults.jl Sun Apr 21 21:00:57 2024 +0300 @@ -13,7 +13,7 @@ export fv_plot, ssim_plot, psnr_plot global mystart = 38 -global myend = 135 +global myend = 75 function fv_plot(name :: String, save_plot::Bool=true) save_path = "./img/$(name)256x256_pdps_known_fv_plot.html"