Sun, 21 Apr 2024 19:05:44 +0300
included zero dual in main module
0 | 1 | ################### |
2 | # Image generation | |
3 | ################### | |
4 | ||
5 | module ImGenerate | |
6 | ||
7 | using ColorTypes: Gray | |
8 | import TestImages | |
9 | # We don't really *directly* depend on QuartzImageIO. The import here is | |
10 | # merely a workaround to suppress warnings when loading TestImages. | |
11 | # Something is broken in those packages. | |
12 | import QuartzImageIO | |
13 | ||
14 | using AlgTools.Util | |
15 | using AlgTools.Comms | |
16 | using ImageTools.Translate | |
17 | ||
18 | using ..OpticalFlow: Image, DisplacementConstant, DisplacementFull | |
8
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
19 | using ..Radon |
0 | 20 | |
5 | 21 | # Added for reproducibility |
22 | import StableRNGs: StableRNG, Random | |
23 | const rng = StableRNG(9182737465) | |
24 | ||
8
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
25 | # Added for PET |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
26 | import PoissonRandom: pois_rand |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
27 | import Random: shuffle |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
28 | import Images: center, warp |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
29 | import CoordinateTransformations: recenter |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
30 | import Rotations: RotMatrix |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
31 | import Interpolations: Flat |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
32 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
33 | |
0 | 34 | ############## |
35 | # Our exports | |
36 | ############## | |
37 | ||
38 | export ImGen, | |
39 | OnlineData, | |
40 | imgen_square, | |
8
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
41 | imgen_shake, |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
42 | PetOnlineData, |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
43 | imgen_shepplogan_radon |
0 | 44 | |
45 | ################## | |
46 | # Data structures | |
47 | ################## | |
48 | ||
49 | struct ImGen | |
50 | f :: Function | |
51 | dim :: Tuple{Int64,Int64} | |
52 | Λ :: Float64 | |
53 | dynrange :: Float64 | |
54 | name :: String | |
55 | end | |
56 | ||
57 | struct OnlineData{DisplacementT} | |
58 | b_true :: Image | |
59 | b_noisy :: Image | |
60 | v :: DisplacementT | |
61 | v_true :: DisplacementT | |
62 | v_cumul_true :: DisplacementT | |
63 | end | |
64 | ||
8
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
65 | struct PetOnlineData{DisplacementT} |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
66 | b_true :: Image |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
67 | sinogram_true :: Image |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
68 | sinogram_noisy :: Image |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
69 | v :: DisplacementT |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
70 | v_true :: DisplacementT |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
71 | v_cumul_true :: DisplacementT |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
72 | theta :: DisplacementT # theta = thetaknown, theta_cumul |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
73 | S :: Image |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
74 | end |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
75 | |
0 | 76 | ################### |
77 | # Shake generation | |
78 | ################### | |
79 | ||
80 | function make_const_v(displ, sz) | |
81 | v = zeros(2, sz...) | |
82 | v[1, :, :] .= displ[1] | |
83 | v[2, :, :] .= displ[2] | |
84 | return v | |
85 | end | |
86 | ||
87 | function shake(params) | |
88 | if !haskey(params, :shaketype) || params.shaketype == :gaussian | |
5 | 89 | return () -> params.shake.*randn(rng,2) |
0 | 90 | elseif params.shaketype == :disk |
91 | return () -> begin | |
5 | 92 | θ = 2π*rand(rng,Float64) |
93 | r = params.shake*√(rand(rng,Float64)) | |
0 | 94 | return [r*cos(θ), r*sin(θ)] |
95 | end | |
96 | elseif params.shaketype == :circle | |
97 | return () -> begin | |
5 | 98 | θ = 2π*rand(rng,Float64) |
0 | 99 | r = params.shake |
100 | return [r*cos(θ), r*sin(θ)] | |
101 | end | |
102 | else | |
103 | error("Unknown shaketype $(params.shaketype)") | |
104 | end | |
105 | end | |
106 | ||
107 | pixelwise = (shakefn, sz) -> () -> make_const_u(shakefn(), sz) | |
108 | ||
8
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
109 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
110 | function rotatebytheta(params) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
111 | r = params.rotation_factor*(2*rand(rng)-1) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
112 | return r |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
113 | end |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
114 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
115 | function generate_radonmask(params) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
116 | imdim = params.radondims |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
117 | sino_sparse = params.sino_sparsity |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
118 | numone = Int64(round(sino_sparse*imdim[1]*imdim[2])) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
119 | numzero = imdim[1]*imdim[2]-numone |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
120 | A = shuffle(rng,reshape([ones(numone); zeros(numzero)],(imdim[1],imdim[2]))) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
121 | return A |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
122 | end |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
123 | |
0 | 124 | ################ |
125 | # Moving square | |
126 | ################ | |
127 | ||
128 | function generate_square(sz, | |
129 | :: Type{DisplacementT}, | |
130 | datachannel :: Channel{OnlineData{DisplacementT}}, | |
131 | params) where DisplacementT | |
132 | ||
133 | if false | |
134 | v₀ = make_const_v(0.1.*(-1, 1), sz) | |
135 | nextv = () -> v₀ | |
136 | elseif DisplacementT == DisplacementFull | |
137 | nextv = pixelwise(shake(params), sz) | |
138 | elseif DisplacementT == DisplacementConstant | |
139 | nextv = shake(params) | |
140 | else | |
141 | @error "Invalid DisplacementT" | |
142 | end | |
143 | ||
144 | # Constant linear displacement everywhere has Jacobian determinant one | |
145 | # (modulo the boundaries which we ignore here) | |
146 | m = round(Int, sz[1]/5) | |
147 | b_orig = zeros(sz...) | |
148 | b_orig[sz[1].-(2*m:3*m), 2*m:3*m] .= 1 | |
149 | ||
150 | v_true = nextv() | |
151 | v_cumul = copy(v_true) | |
152 | ||
153 | while true | |
154 | # Flow original data and add noise | |
155 | b_true = zeros(sz...) | |
156 | translate_image!(b_true, b_orig, v_cumul; threads=true) | |
5 | 157 | b = b_true .+ params.noise_level.*randn(rng,sz...) |
158 | v = v_true.*(1.0 .+ params.shake_noise_level.*randn(rng,size(v_true)...)) | |
0 | 159 | # Pass true data to iteration routine |
160 | data = OnlineData{DisplacementT}(b_true, b, v, v_true, v_cumul) | |
161 | if !put_unless_closed!(datachannel, data) | |
162 | return | |
163 | end | |
164 | # Next step shake | |
165 | v_true = nextv() | |
166 | v_cumul .+= v_true | |
167 | end | |
168 | end | |
169 | ||
170 | function imgen_square(sz) | |
171 | return ImGen(curry(generate_square, sz), sz, 1, 1, "square$(sz[1])x$(sz[2])") | |
172 | end | |
173 | ||
174 | ################ | |
175 | # Shake a photo | |
176 | ################ | |
177 | ||
178 | function generate_shake_image(im, sz, | |
179 | :: Type{DisplacementConstant}, | |
180 | datachannel :: Channel{OnlineData{DisplacementConstant}}, | |
181 | params :: NamedTuple) | |
8
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
182 | |
7 | 183 | # Restart the seed to enable comparison across predictors |
8
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
184 | Random.seed!(rng,9182737465) |
7 | 185 | |
0 | 186 | nextv = shake(params) |
187 | v_true = nextv() | |
188 | v_cumul = copy(v_true) | |
189 | ||
190 | while true | |
191 | # Extract subwindow of original image and add noise | |
192 | b_true = zeros(sz...) | |
193 | extract_subimage!(b_true, im, v_cumul; threads=true) | |
5 | 194 | b = b_true .+ params.noise_level.*randn(rng,sz...) |
195 | v = v_true.*(1.0 .+ params.shake_noise_level.*randn(rng,size(v_true)...)) | |
0 | 196 | # Pass data to iteration routine |
197 | data = OnlineData{DisplacementConstant}(b_true, b, v, v_true, v_cumul) | |
198 | if !put_unless_closed!(datachannel, data) | |
199 | return | |
200 | end | |
201 | # Next step shake | |
202 | v_true = nextv() | |
203 | v_cumul .+= v_true | |
204 | end | |
205 | end | |
206 | ||
207 | function imgen_shake(imname, sz) | |
208 | im = Float64.(Gray.(TestImages.testimage(imname))) | |
209 | dynrange = maximum(im) | |
210 | return ImGen(curry(generate_shake_image, im, sz), sz, 1, dynrange, | |
211 | "$(imname)$(sz[1])x$(sz[2])") | |
212 | end | |
213 | ||
8
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
214 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
215 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
216 | ######################################################################## |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
217 | # PETscan |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
218 | ######################################################################## |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
219 | function generate_radon(im, sz, |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
220 | :: Type{DisplacementConstant}, |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
221 | datachannel :: Channel{PetOnlineData{DisplacementConstant}}, |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
222 | params :: NamedTuple) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
223 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
224 | # Restart the seed to enable comparison across predictors |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
225 | Random.seed!(rng,9182737465) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
226 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
227 | nextv = shake(params) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
228 | v_true = nextv() |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
229 | v_cumul = copy(v_true) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
230 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
231 | S_true = generate_radonmask(params) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
232 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
233 | theta_true = rotatebytheta(params) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
234 | theta_cumul = copy(theta_true) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
235 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
236 | while true |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
237 | # Define the transformation matrix |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
238 | center_point = (sz[1]/2 + v_true[1], sz[2]/2 + v_true[2]) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
239 | tform = recenter(RotMatrix(theta_cumul), center_point) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
240 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
241 | # Apply the transformation to the image using warp |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
242 | b_true = copy(warp(im, tform, axes(im), fillvalue=Flat())) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
243 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
244 | v = v_true.*(1.0 .+ params.shake_noise_level.*randn(rng,size(v_true)...)) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
245 | theta = theta_true*(1.0 + params.rotation_noise_level.*randn(rng)) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
246 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
247 | # Generate the true and noisy sinograms |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
248 | sinogram_true = zeros(params.radondims...) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
249 | sinogram_true .*= params.scale |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
250 | radon!(sinogram_true, b_true) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
251 | sinogram_noisy = copy(sinogram_true) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
252 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
253 | for i=1:params.radondims[1], j=1:params.radondims[2] |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
254 | sinogram_noisy[i, j] += pois_rand(rng,params.noise_level) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
255 | end |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
256 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
257 | # Pass data to iteration routine |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
258 | data = PetOnlineData{DisplacementConstant}(b_true, sinogram_true, sinogram_noisy, v, v_true, v_cumul, [theta, theta_cumul], S_true) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
259 | if !put_unless_closed!(datachannel, data) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
260 | return |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
261 | end |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
262 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
263 | # Next step shake |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
264 | v_true = nextv() |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
265 | v_cumul .+= v_true |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
266 | # Next theta |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
267 | theta_true = rotatebytheta(params) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
268 | theta_cumul += theta_true |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
269 | # Next sinogram mask |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
270 | S_true = generate_radonmask(params) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
271 | end |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
272 | end |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
273 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
274 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
275 | function imgen_shepplogan_radon(origsize,sz) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
276 | im = convert(Array{Float64},TestImages.shepp_logan(origsize, highContrast=true)) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
277 | dynrange = maximum(im) |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
278 | return ImGen(curry(generate_radon, im, sz), sz, 1, dynrange, "shepplogan$(sz[1])x$(sz[2])") |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
279 | end |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
280 | |
e4ad8f7ce671
Added PET and updated README
Neil Dizon <neil.dizon@helsinki.fi>
parents:
7
diff
changeset
|
281 | |
0 | 282 | end # Module |