renamed generate_radon as generate_sinogram

Sun, 21 Apr 2024 21:00:57 +0300

author
Neil Dizon <neil.dizon@helsinki.fi>
date
Sun, 21 Apr 2024 21:00:57 +0300
changeset 24
2d9e64235ba7
parent 23
1c4b7d1f261f
child 25
c9b06736a477

renamed generate_radon as generate_sinogram

src/ImGenerate.jl file | annotate | diff | comparison | revisions
src/PET/ImGenerate.jl file | annotate | diff | comparison | revisions
src/PET/PlotResults.jl file | annotate | diff | comparison | revisions
--- 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)
--- 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)
--- 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"

mercurial