--- a/src/PET/ImGenerate.jl Sun Apr 21 12:46:04 2024 +0300 +++ b/src/PET/ImGenerate.jl Sun Apr 21 13:41:35 2024 +0300 @@ -181,7 +181,7 @@ params :: NamedTuple) # Restart the seed to enable comparison across predictors - Random.seed!(rng,9182737465) + Random.seed!(rng,314159) nextv = shake(params) v_true = nextv() @@ -217,20 +217,25 @@ # PETscan ######################################################################## function generate_radon(im, sz, - :: Type{DisplacementConstant}, - datachannel :: Channel{PetOnlineData{DisplacementConstant}}, - params :: NamedTuple) + :: Type{DisplacementConstant}, + datachannel :: Channel{PetOnlineData{DisplacementConstant}}, + params :: NamedTuple) + + # Set up counter and zero factor for stabilisation + @assert(params.maxiter ≥ maximum(params.stable_interval)) + indx = 1 + zero_factor = indx in params.stable_interval ? 0.0 : 1.0 # Restart the seed to enable comparison across predictors - Random.seed!(rng,9182737465) + Random.seed!(rng,9182737465) nextv = shake(params) - v_true = nextv() + v_true = zero_factor.*nextv() v_cumul = copy(v_true) S_true = generate_radonmask(params) - theta_true = rotatebytheta(params) + theta_true = zero_factor*rotatebytheta(params) theta_cumul = copy(theta_true) while true @@ -261,13 +266,16 @@ end # Next step shake - v_true = nextv() + v_true = zero_factor.*nextv() v_cumul .+= v_true # Next theta - theta_true = rotatebytheta(params) + theta_true = zero_factor*rotatebytheta(params) theta_cumul += theta_true # Next sinogram mask S_true = generate_radonmask(params) + # Update indx and zero factor + indx += 1 + zero_factor = indx in params.stable_interval ? 0.0 : 1.0 end end