 trunk/TODO 2011/05/09 16:40:35 1161
+++ trunk/TODO 2011/05/09 18:56:15 1162
@@ 1,16 +1,18 @@
NOTE: GLK's approximate ranking of 5 most important tagged with
+NOTE: GLK's approximate ranking of 8 most important tagged with
[GLK:1], [GLK:2], ...
========================
SHORT TERM ============= (*needed* for streamlines & tractography)
========================
[GLK:1] Add sequence types (needed for evals & evecs)
+[GLK:3] Add sequence types (needed for evals & evecs)
syntax
types: ty '{' INT '}'
value construction: '{' e1 ',' … ',' en '}'
indexing: e '{' e '}'
[GLK:1] evals & evecs for symmetric tensor[3,3] (requires sequences)
+
+[GLK:4] evals & evecs for symmetric tensor[2,2] and
+tensor[3,3] (requires sequences)
ability to emit/track/record variables into dynamically resized
runtime buffer
@@ 18,52 +20,61 @@
tensor fields: convolution on general tensor images
========================
SHORTISH TERM ========= (to make using Diderot less annoying/slow)
========================
+SHORTISH TERM ========= (to make using Diderot less annoying to
+======================== program in, and slow to execute)
valuenumbering optimization
proper handling of stabilize method
+[GLK:1] Add a clamp function, which takes three arguments; either
+three scalars:
+ clamp(lo, hi, x) = max(lo, min(hi, x))
+or three vectors of the same size:
+ clamp(lo, hi, [x,y]) = [max(lo[0], min(hi[0], x)),
+ max(lo[1], min(hi[1], y))]
+This would be useful in many current Diderot programs.
+One question: clamp(x, lo, hi) is the argument order used in OpenCL
+and other places, but clamp(lo, hi, x) is much more consistent with
+lerp(lo, hi, x), hence GLK's preference
+
+[GLK:2] Proper handling of stabilize method
+
+allow "*" to represent "modulate": percomponent multiplication of
+vectors, and vectors only (not tensors of order 2 or higher). Once
+sequences are implemented this should be removed: the operation is not
+invariant WRT basis so it is not a legit vector computation.
+
+implicit type promotion of integers to reals where reals are
+required (e.g. not exponentiation "^")
[GLK:2] Save Diderot output to nrrd, instead of "mip.txt"
+[GLK:5] Save Diderot output to nrrd, instead of "mip.txt"
For grid of strands, save to similarlyshaped array
For list of strands, save to long 1D (or 2D for nonscalar output) list
For ragged things (like tractography output), will need to save both
complete list of values, as well as list of start indices and lengths
to index into complete list
[GLK:3] Use of Teem's "hest" commandline parser for getting
+[GLK:6] Use of Teem's "hest" commandline parser for getting
any input variables that are not defined in the source file
[GLK:4] ability to declare a field so that probe positions are
+[GLK:7] ability to declare a field so that probe positions are
*always* "inside"; with various ways of mapping the known image values
to nonexistant index locations. One possible syntax emphasizes that
there is a index mapping function that logically precedes convolution:
 F = bspln3 ⊛ (img clamp)
+ F = bspln3 ⊛ (img ◦ clamp)
F = bspln3 ⊛ (img ◦ repeat)
F = bspln3 ⊛ (img ◦ mirror)
where "◦" or "∘" is used to indicate function composition
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).

Level of differentiability in field type should be statement about how
much differentiation the program *needs*, rather than what the kernel
*provides*. The needed differentiability can be less than or equal to
the provided differentiability.
+Use ∇⊗ etc. syntax
+ syntax [DONE]
+ typechecking
+ IL and codegen
+
Add type aliases for color types
rgb = real{3}
rgba = real{4}
@@ 94,6 +105,9 @@
support for Python interop and GUI
+Allow integer exponentiation ("^2") to apply to square matrices,
+to represent repeated matrix multiplication
+
Alow X *= Y, X /= Y, X += Y, X = Y to mean what they do in C,
provided that X*Y, X/Y, X+Y, XY are already supported.
Nearly every Diderot program would be simplified by this.
@@ 142,33 +156,34 @@
(but we should only duplicate over the liverange of the result of the
conditional.
[GLK:5] Want: nontrivial field expressions & functions:
+[GLK:8] Want: nontrivial field expressions & functions.
+scalar fields from scalar fields F and G:
+ field#0(2)[] X = (sin(F) + 1.0)/2;
+ field#0(2)[] X = F*G;
+scalar field of vector field magnitude:
image(2)[2] Vimg = load(...);
field#0(2)[] Vlen = Vimg ⊛ bspln3;
to get a scalar field of vector length, or
+field of normalized vectors (for LIC and vector field feature extraction)
+ field#2(2)[2] F = ...
+ field#0(2)[2] V = normalize(F);
+scalar field of gradient magnitude (for edge detection))
field#2(2)[] F = Fimg ⊛ bspln3;
field#0(2)[] Gmag = ∇F;
to get a scalar field of gradient magnitude, or
+scalar field of squared gradient magnitude (simpler to differentiate):
field#2(2)[] F = Fimg ⊛ bspln3;
field#0(2)[] Gmsq = ∇F•∇F;
to get a scalar field of squared gradient magnitude, which is simpler
to differentiate. However, there is value in having these, even if
the differentiation of them is not supported (hence the indication
of "field#0" for these above)

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.
+There is value in having these, even if the differentiation of them is
+not supported (hence the indication of "field#0" for these above)
+
+co vs contra index distinction
Permit fields composition, especially for warping images by a
smooth field of deformation vectors
+Permit field composition:
field#2(3)[3] warp = bspln3 ⊛ warpData;
field#2(3)[] F = bspln3 ⊛ img;
field#2(3)[] Fwarp = F ◦ warp;
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.
+This will be instrumental for expressing nonrigid registration
+methods (but those will require covscontra index distinction)
Allow the convolution to be specified either as a single 1D kernel
(as we have it now):
@@ 177,13 +192,15 @@
field#0(3)[] F = (bspln3 ⊗ bspln3 ⊗ tent) ⊛ img;
This is especially important for things like timevarying data, or
other multidimensional fields where one axis of the domain is very
different from the rest. What is very unclear is how, in such cases,
+different from the rest, and hence must be treated separately when
+it comes to convolution. What is very unclear is how, in such cases,
we should notate the gradient, when we only want to differentiate with
respect to some of the axes.

co vs contra index distinction
+respect to some subset of the axes. One ambitious idea would be:
+ field#0(3)[] Ft = (bspln3 ⊗ bspln3 ⊗ tent) ⊛ img; // 2D timevarying field
+ field#0(2)[] F = lambda([x,y], Ft([x,y,42.0])) // restriction to time=42.0
+ vec2 grad = ∇F([x,y]); // 2D gradient
some indication of tensor symmetry
+representation of tensor symmetry
(have to identify the group of index permutations that are symmetries)
dot works on all tensors