 branches/purecfg/TODO 2011/04/25 15:01:00 964
+++ branches/purecfg/TODO 2011/06/15 16:54:21 1350
@@ 1,74 +1,47 @@
NOTE: GLK's approximate ranking of 6 most imporant tagged with
+NOTE: GLK's approximate ranking of 8 most important tagged with
[GLK:1], [GLK:2], ...
========================
SHORT TERM ============= (for curvaturebased VR)
+SHORT TERM ============= (*needed* for streamlines & tractography)
========================
IL support for higherorder tensor values (matrices, etc).
 tensor construction [DONE]
 tensor indexing [DONE]
 tensor slicing
 verify that hessians work correctly [DONE]

Outer products [DONE]

Add M dot v, v dot M, and M dot N [DONE]
+Remove CL from compiler
Identity matrix [DONE]

Zero tensor [DONE]

trace [DONE]

extend norm (exp) to tensor[3,3] [DONE]

Matrix addition, subtraction, and scaling [DONE]

Use ∇⊗ etc. syntax
 syntax [DONE]
 typechecking
 IL and codegen

Add sequence types
+[GLK:2] Add sequence types (needed for evals & evecs)
syntax
types: ty '{' INT '}'
value construction: '{' e1 ',' … ',' en '}'
indexing: e '{' e '}'
Infix dot product and cross product [DONE]

lerp on scalars and vectors [DONE]
+[GLK:3] evals & evecs for symmetric tensor[2,2] and
+tensor[3,3] (requires sequences)
Infix "^" operator for pow() [DONE]

Code generation support for 1D image data, such as RGBA transfer functions [DONE]

==============================
other SHORT TERM ============= (including needed for LIC)
==============================
+ability to emit/track/record variables into dynamically resized
+runtime buffer
test/uninit.diderot:
documents need for better compiler error messages when output variables
are not initialized; the current messages are very cryptic
+tensor fields: convolution on general tensor images
determinant ("det") for tensor[3,3]
+========================
+SHORTISH TERM ========= (to make using Diderot less annoying to
+======================== program in, and slow to execute)
extend norm (exp) to all tensor types [DONE for vectors and matrices]
+valuenumbering optimization [DONE]
expand trace in mid to low translation
+Allow ".ddro" file extensions in addition to ".diderot"
valuenumbering optimization
+Be able to output values of type tensor[2,2] and tensor[3,3];
+(currently only scalars & vectors). Want to add some regression tests
+based on this and currently can't
Add type aliases for color types
 rgb = real{3}
 rgba = real{4}
+[GLK:1] Proper handling of stabilize method
==============================
MEDIUM TERM ================== (including needed for streamlines & tractography)
==============================
+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.
[GLK:3] evals & evecs for symmetric tensor[3,3] (requires sequences)
+implicit type promotion of integers to reals where reals are
+required (e.g. not exponentiation "^")
[GLK:4] Save Diderot output to nrrd, instead of "mip.txt"
For grid of strands, save to similarlyshaped array
@@ 78,79 +51,93 @@
to index into complete list
[GLK:5] Use of Teem's "hest" commandline parser for getting
any input variables that are not defined in the source file

[GLK:6] ability to declare a field in such a way so that probe
positions are *always* clamped to the support of "inside";
there are many cases where this is the sensible behavior.
(More generally, we could also have "repeat" declaration,
copying action of GL_REPEAT in texturing)

ability to emit/track/record variables into dynamically resized
runtime buffer
+any "input" variables that are not defined in the source file.
Want: allow 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.
+[GLK:6] 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 ◦ repeat)
+ F = bspln3 ⊛ (img ◦ mirror)
+where "◦" or "∘" is used to indicate function composition
+
+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.
Want: nontrivial field expressions & functions:
 image(2)[2] Vimg = load(...);
 field#0(2)[] Vlen = Vimg ⊛ bspln3;
to get a scalar field of vector length, or
 field#2(2)[] F = Fimg ⊛ bspln3;
 field#0(2)[] Gmag = ∇F;
to get a scalar field of gradient magnitude, or
 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.
+Use ∇⊗ etc. syntax
+ syntax [DONE]
+ typechecking
+ IL and codegen
tensor fields: convolution on general tensor images
+Add type aliases for color types
+ rgb = real{3}
+ rgba = real{4}
==============================
other MEDIUM TERM ============ (needed for particles)
+MEDIUM TERM ================== (*needed* for particles)
==============================
runtime birth and death of strands
+runtime birth of strands
"initially" supports lists
"initially" supports lists of positions output from
different initalization Diderot program
+"initially" supports lists of positions output from different
+initalization Diderot program (or output from the same program;
+e.g. using output of iso2d.diderot for one isovalue to seed the input
+to another invocation of the same program)
+
+Communication between strands: they have to be able to learn each
+other's state (at the previous iteration). Early version of this can
+have the network of neighbors be completely static (for running one
+strand/pixel image computations). Later version with strands moving
+through the domain will require some spatial data structure to
+optimize discovery of neighbors.
+
+============================
+MEDIUMISH TERM ============ (to make Diderot more useful/effective)
+============================
spatial data structure that permits strands' queries of neighbors
+Python/ctypes interface to runtime
proper handling of stabilize method
+support for Python interop and GUI
test/vrkcomp2.diderot: Add support for code like
+Allow integer exponentiation ("^2") to apply to square matrices,
+to represent repeated matrix multiplication
 (F1 if x else F2)@pos
+Put small 1D and 2D fields, when reconstructed specifically by tent
+and when differentiation is not needed, into faster texture buffers.
+test/illustvr.diderot is good example of program that uses multiple
+such 1D fields basically as lookuptablebased function evaluation
This will require duplication of the continuation of the conditional
(but we should only duplicate over the liverange of the result of the
conditional.
+expand trace in mid to low translation [DONE]
==============================
other MEDIUM TERM ============
==============================
+extend norm (exp) to all tensor types [DONE for vectors and matrices]
+
+determinant ("det") for tensor[3,3]
+
+add ":" for tensor dot product (contracts out two indices
+instead of one like •), valid for all pairs of tensors with
+at least two indices
+
+test/uninit.diderot:
+documents need for better compiler error messages when output variables
+are not initialized; the current messages are very cryptic
want: warnings when "D" (reserved for differentiation) is declared as
a variable name (get confusing error messages now)
support for Python interop and GUI

==============================
LONG TERM ====================
==============================
+LONG TERM ==================== (make Diderot more interesting/attractive from
+============================== a research standpoint)
+
+IL support for higherorder tensor values (matrices, etc).
+ tensor construction [DONE]
+ tensor indexing [DONE]
+ tensor slicing
+ verify that hessians work correctly [DONE]
Better handling of variables that determines the scope of a variable
based on its actual use, instead of where the user defined it. So,
@@ 158,65 +145,112 @@
scope. Also prune out useless variables, which should include field
variables after the translation to midil.
+test/vrkcomp2.diderot: Add support for code like
+ (F1 if x else F2)@pos
+This will require duplication of the continuation of the conditional
+(but we should only duplicate over the liverange of the result of the
+conditional.
+
+[GLK:7] 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;
+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;
+scalar field of squared gradient magnitude (simpler to differentiate):
+ field#2(2)[] F = Fimg ⊛ bspln3;
+ field#0(2)[] Gmsq = ∇F•∇F;
+There is value in having these, even if the differentiation of them is
+not supported (hence the indication of "field#0" for these above)
+
+Introduce region types (syntax region(d), where d is the dimension of the
+region. One useful operator would be
+ dom : field#k(d)[s] > region(d)
+Then the inside test could be written as
+ pos ∈ dom(F)
+We could further extend this approach to allow geometric definitions of
+regions. It might also be useful to do inside tests in world space,
+instead of image space.
+
co vs contra index distinction
add ":" for tensor dot product (contracts out two indices
instead of one like •), valid for all pairs of tensors with
at least two indices
+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.
+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):
+ field#2(3)[] F = bspln3 ⊛ img;
+or, as a tensor product of kernels, one for each axis, e.g.
+ field#0(3)[] F = (bspln3 ⊗ bspln3 ⊗ tent) ⊛ img;
+This is especially important for things like timevarying fields
+and the use of scalespace in field visualization: one axis of the
+must be convolved with a different kernel during probing.
+What is very unclear is how, in such cases, we should notate the
+gradient, when we only want to differentiate with 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
+
+Tensors of order 3 (e.g. gradients of diffusion tensor fields, or
+hessians of vector fields) and order 4 (e.g. Hessians of diffusion
+tensor fields).
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
outer works on all tensors
+Help for debugging Diderot programs: need to be able to uniquely
+identify strands, and for particular strands that are known to behave
+badly, do something like printf or other logging of their computations
+and updates.
+
+Permit writing dimensionally general code: Have some statement of the
+dimension of the world "W" (or have it be learned from one particular
+field of interest), and then able to write "vec" instead of
+"vec2/vec3", and perhaps "tensor[W,W]" instead of
+"tensor[2,2]/tensor[3,3]"
+
+Traits: all things things that have boilerplate code (especially
+volume rendering) should be expressed in terms of the unique
+computational core. Different kinds of streamline/tractography
+computation will be another example, as well as particle systems.
+
Einstein summation notation
"tensor comprehension" (like list comprehension)
Python/ctypes interface to runtimez
+Fields coming from different sources of data:
+* triangular or tetrahedral meshes over 2D or 3D domains (of the
+ source produced by finiteelement codes; these will come with their
+ own specialized kinds of reconstruction kernels, called "basis
+ functions" in this context)
+* Large point clouds, with some radial basis function around each point,
+ which will be tuned by parameters of the point (at least one parameter
+ giving some notion of radius)
======================
BUGS =================
======================
[GLK:1] test/derivs2.diderot:
test/derivs3.diderot:
gradients & Hessians are not being transformed from indextoworld,
these test programs should produce black images when that is working

[GLK:2] test/fields.diderot:
documents various bugs/questions associated with simple field expressions
(negation, addition, scalar multiplication)

test/read2vecs.diderot:
// HEY (BUG?) shouldn't it be a type error to load this 2D array of
// 2vectors into a 2D *scalar* field? Instead, get:
// uncaught exception Fail [Fail: Error in compiling lic.diderot]
// raised at driver/main.sml:31.3931.76
image(2)[] Vimg = load("../data/vorttest.nrrd");

test/iso2d.diderot: not able to use "nan".
 // HEY (BUG) not able to use NaN as in "pos = [nan,nan]"
 // generated C code "vec2f(nanf, nanf)" causes problems:
 // iso2d.c: In function ‘sample_update’:
 // iso2d.c:86: error: incompatible type for argument 1 of ‘vec2f’
 // iso2d.c:86: error: incompatible type for argument 2 of ‘vec2f’
 // uncaught exception Fail [Fail: error compiling/linking]
 // raised at ctarget/ctarget.sml:323.14323.44
 pos = [∞,∞]; // should be: pos = [nan,nan];

test/vrkcomp.diderot:
 // HEY (scoping BUG): the strand parameters (e.g. ui, vi) ...

test/zslice2.diderot:
// but is this not valid syntax for creating field in one shot?
//field#2(3)[] F = (load("../data/zimg112.nrrd")) ⊛ bspln3;
// It is valid syntax, but there is a bug in the conversion from HighIL to MidIL

test/zslice2.diderot:
// HEY (bug) bspln5 leads to problems ...
// uncaught exception Size [size]
// raised at ctarget/ctarget.sml:47.1547.19
//field#4(3)[] F = img ⊛ bspln5;
+