1 
NOTE: GLK's approximate ranking of 5 most important tagged with 
NOTE: GLK's approximate ranking of 8 most important tagged with 
2 
[GLK:1], [GLK:2], ... 
[GLK:1], [GLK:2], ... 
3 


4 
======================== 
======================== 
5 
SHORT TERM ============= (*needed* for streamlines & tractography) 
SHORT TERM ============= (*needed* for streamlines & tractography) 
6 
======================== 
======================== 
7 


8 
[GLK:1] Add sequence types (needed for evals & evecs) 
[GLK:3] Add sequence types (needed for evals & evecs) 
9 
syntax 
syntax 
10 
types: ty '{' INT '}' 
types: ty '{' INT '}' 
11 
value construction: '{' e1 ',' … ',' en '}' 
value construction: '{' e1 ',' … ',' en '}' 
12 
indexing: e '{' e '}' 
indexing: e '{' e '}' 
13 
[GLK:1] evals & evecs for symmetric tensor[3,3] (requires sequences) 

14 

[GLK:4] evals & evecs for symmetric tensor[2,2] and 
15 

tensor[3,3] (requires sequences) 
16 


17 
ability to emit/track/record variables into dynamically resized 
ability to emit/track/record variables into dynamically resized 
18 
runtime buffer 
runtime buffer 
20 
tensor fields: convolution on general tensor images 
tensor fields: convolution on general tensor images 
21 


22 
======================== 
======================== 
23 
SHORTISH TERM ========= (to make using Diderot less annoying/slow) 
SHORTISH TERM ========= (to make using Diderot less annoying to 
24 
======================== 
======================== program in, and slow to execute) 
25 


26 

valuenumbering optimization [DONE, but needs more testing] 
27 


28 

[GLK:1] Add a clamp function, which takes three arguments; either 
29 

three scalars: 
30 

clamp(lo, hi, x) = max(lo, min(hi, x)) 
31 

or three vectors of the same size: 
32 

clamp(lo, hi, [x,y]) = [max(lo[0], min(hi[0], x)), 
33 

max(lo[1], min(hi[1], y))] 
34 

This would be useful in many current Diderot programs. 
35 

One question: clamp(x, lo, hi) is the argument order used in OpenCL 
36 

and other places, but clamp(lo, hi, x) is much more consistent with 
37 

lerp(lo, hi, x), hence GLK's preference 
38 


39 

[GLK:2] Proper handling of stabilize method 
40 


41 
valuenumbering optimization 
allow "*" to represent "modulate": percomponent multiplication of 
42 

vectors, and vectors only (not tensors of order 2 or higher). Once 
43 

sequences are implemented this should be removed: the operation is not 
44 

invariant WRT basis so it is not a legit vector computation. 
45 


46 
proper handling of stabilize method 
implicit type promotion of integers to reals where reals are 
47 

required (e.g. not exponentiation "^") 
48 


49 
[GLK:2] Save Diderot output to nrrd, instead of "mip.txt" 
[GLK:5] Save Diderot output to nrrd, instead of "mip.txt" 
50 
For grid of strands, save to similarlyshaped array 
For grid of strands, save to similarlyshaped array 
51 
For list of strands, save to long 1D (or 2D for nonscalar output) list 
For list of strands, save to long 1D (or 2D for nonscalar output) list 
52 
For ragged things (like tractography output), will need to save both 
For ragged things (like tractography output), will need to save both 
53 
complete list of values, as well as list of start indices and lengths 
complete list of values, as well as list of start indices and lengths 
54 
to index into complete list 
to index into complete list 
55 


56 
[GLK:3] Use of Teem's "hest" commandline parser for getting 
[GLK:6] Use of Teem's "hest" commandline parser for getting 
57 
any input variables that are not defined in the source file 
any input variables that are not defined in the source file 
58 


59 
[GLK:4] ability to declare a field so that probe positions are 
[GLK:7] ability to declare a field so that probe positions are 
60 
*always* "inside"; with various ways of mapping the known image values 
*always* "inside"; with various ways of mapping the known image values 
61 
to nonexistant index locations. One possible syntax emphasizes that 
to nonexistant index locations. One possible syntax emphasizes that 
62 
there is a index mapping function that logically precedes convolution: 
there is a index mapping function that logically precedes convolution: 
63 
F = bspln3 ⊛ (img clamp) 
F = bspln3 ⊛ (img ◦ clamp) 
64 
F = bspln3 ⊛ (img ◦ repeat) 
F = bspln3 ⊛ (img ◦ repeat) 
65 
F = bspln3 ⊛ (img ◦ mirror) 
F = bspln3 ⊛ (img ◦ mirror) 
66 
where "◦" or "∘" is used to indicate function composition 
where "◦" or "∘" is used to indicate function composition 
67 



Use ∇⊗ etc. syntax 


syntax [DONE] 


typechecking 


IL and codegen 





Add a clamp function, which takes three arguments; either three scalars: 


clamp(x, minval, maxval) = max(minval, min(maxval, x)) 


or three vectors of the same size: 


clamp([x,y], minvec, maxvec) = [max(minvec[0], min(maxvec[0], x)), 


max(minvec[1], min(maxvec[1], y))] 


This would be useful in many current Diderot programs. 


One question: clamp(x, minval, maxval) is the argument order 


used in OpenCL and other places, but clamp(minval, maxval, x) 


would be more consistent with lerp(minout, maxout, x). 




68 
Level of differentiability in field type should be statement about how 
Level of differentiability in field type should be statement about how 
69 
much differentiation the program *needs*, rather than what the kernel 
much differentiation the program *needs*, rather than what the kernel 
70 
*provides*. The needed differentiability can be less than or equal to 
*provides*. The needed differentiability can be less than or equal to 
71 
the provided differentiability. 
the provided differentiability. 
72 


73 

Use ∇⊗ etc. syntax 
74 

syntax [DONE] 
75 

typechecking 
76 

IL and codegen 
77 


78 
Add type aliases for color types 
Add type aliases for color types 
79 
rgb = real{3} 
rgb = real{3} 
80 
rgba = real{4} 
rgba = real{4} 
105 


106 
support for Python interop and GUI 
support for Python interop and GUI 
107 


108 

Allow integer exponentiation ("^2") to apply to square matrices, 
109 

to represent repeated matrix multiplication 
110 


111 
Alow X *= Y, X /= Y, X += Y, X = Y to mean what they do in C, 
Alow X *= Y, X /= Y, X += Y, X = Y to mean what they do in C, 
112 
provided that X*Y, X/Y, X+Y, XY are already supported. 
provided that X*Y, X/Y, X+Y, XY are already supported. 
113 
Nearly every Diderot program would be simplified by this. 
Nearly every Diderot program would be simplified by this. 
156 
(but we should only duplicate over the liverange of the result of the 
(but we should only duplicate over the liverange of the result of the 
157 
conditional. 
conditional. 
158 


159 
[GLK:5] Want: nontrivial field expressions & functions: 
[GLK:8] Want: nontrivial field expressions & functions. 
160 

scalar fields from scalar fields F and G: 
161 

field#0(2)[] X = (sin(F) + 1.0)/2; 
162 

field#0(2)[] X = F*G; 
163 

scalar field of vector field magnitude: 
164 
image(2)[2] Vimg = load(...); 
image(2)[2] Vimg = load(...); 
165 
field#0(2)[] Vlen = Vimg ⊛ bspln3; 
field#0(2)[] Vlen = Vimg ⊛ bspln3; 
166 
to get a scalar field of vector length, or 
field of normalized vectors (for LIC and vector field feature extraction) 
167 

field#2(2)[2] F = ... 
168 

field#0(2)[2] V = normalize(F); 
169 

scalar field of gradient magnitude (for edge detection)) 
170 
field#2(2)[] F = Fimg ⊛ bspln3; 
field#2(2)[] F = Fimg ⊛ bspln3; 
171 
field#0(2)[] Gmag = ∇F; 
field#0(2)[] Gmag = ∇F; 
172 
to get a scalar field of gradient magnitude, or 
scalar field of squared gradient magnitude (simpler to differentiate): 
173 
field#2(2)[] F = Fimg ⊛ bspln3; 
field#2(2)[] F = Fimg ⊛ bspln3; 
174 
field#0(2)[] Gmsq = ∇F•∇F; 
field#0(2)[] Gmsq = ∇F•∇F; 
175 
to get a scalar field of squared gradient magnitude, which is simpler 
There is value in having these, even if the differentiation of them is 
176 
to differentiate. However, there is value in having these, even if 
not supported (hence the indication of "field#0" for these above) 
177 
the differentiation of them is not supported (hence the indication 

178 
of "field#0" for these above) 
co vs contra index distinction 




Want: ability to apply "normalize" to a field itself, e.g. 


field#0(2)[2] V = normalize(Vimg ⊛ ctmr); 


so that V(x) = normalize((Vimg ⊛ ctmr)(x)). 


Having this would simplify expression of standard LIC method, and 


would also help express other vector field expressions that arise 


in vector field feature exraction. 

179 


180 
Permit fields composition, especially for warping images by a 
Permit field composition: 

smooth field of deformation vectors 

181 
field#2(3)[3] warp = bspln3 ⊛ warpData; 
field#2(3)[3] warp = bspln3 ⊛ warpData; 
182 
field#2(3)[] F = bspln3 ⊛ img; 
field#2(3)[] F = bspln3 ⊛ img; 
183 
field#2(3)[] Fwarp = F ◦ warp; 
field#2(3)[] Fwarp = F ◦ warp; 
184 
So Fwarp(x) = F(warp(X)). Chain rule can be used for differentation 
So Fwarp(x) = F(warp(X)). Chain rule can be used for differentation. 
185 

This will be instrumental for expressing nonrigid registration 
186 

methods (but those will require covscontra index distinction) 
187 


188 
Allow the convolution to be specified either as a single 1D kernel 
Allow the convolution to be specified either as a single 1D kernel 
189 
(as we have it now): 
(as we have it now): 
192 
field#0(3)[] F = (bspln3 ⊗ bspln3 ⊗ tent) ⊛ img; 
field#0(3)[] F = (bspln3 ⊗ bspln3 ⊗ tent) ⊛ img; 
193 
This is especially important for things like timevarying data, or 
This is especially important for things like timevarying data, or 
194 
other multidimensional fields where one axis of the domain is very 
other multidimensional fields where one axis of the domain is very 
195 
different from the rest. What is very unclear is how, in such cases, 
different from the rest, and hence must be treated separately when 
196 

it comes to convolution. What is very unclear is how, in such cases, 
197 
we should notate the gradient, when we only want to differentiate with 
we should notate the gradient, when we only want to differentiate with 
198 
respect to some of the axes. 
respect to some subset of the axes. One ambitious idea would be: 
199 

field#0(3)[] Ft = (bspln3 ⊗ bspln3 ⊗ tent) ⊛ img; // 2D timevarying field 
200 
co vs contra index distinction 
field#0(2)[] F = lambda([x,y], Ft([x,y,42.0])) // restriction to time=42.0 
201 

vec2 grad = ∇F([x,y]); // 2D gradient 
202 


203 
some indication of tensor symmetry 
representation of tensor symmetry 
204 
(have to identify the group of index permutations that are symmetries) 
(have to identify the group of index permutations that are symmetries) 
205 


206 
dot works on all tensors 
dot works on all tensors 