src/ImGenerate.jl

Fri, 03 May 2024 12:40:26 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Fri, 03 May 2024 12:40:26 -0500
changeset 56
cfce789d9749
parent 39
b180a4f3b9bd
permissions
-rw-r--r--

Add more authors and version

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

mercurial