Radial Fields
For some work I was supposed to do later this term, I wanted a few synthetic vector/tensor fields. Something more complicated than a regular planar field.
I’ve used radial and tangential fields in electromagnetics (think
solenoids and inductors) countless times, so it should be trivial to
generate one, shouldn’t it? Unfortunately, I was getting mixed up in
the minus signs somewhere and for the life of me couldn’t find out
where. I checked and rechecked my math. I checked the usage of
atan2(3) instead of atan(3). Finally, I had to resort to
generating them by rotating the Cartesian basis and regenerating the
tensors from the spectral components. Hacky, cludgy and doesn’t follow
the DRY principle but this is just a test case. Yay tangential field:

To check the robustness of my algorithms later on, I need to add some noise to the fields and see how well they perform. Plagued by partial volume effects, diffusion tensor data are inherently very noisy, so it’ll be good to include noise as part of the algorithm development process. Right now, modeling noise in tensors is a very complicated process because the tensors themselves are built through a linear regression from diffusion weighted images. The noise is definitely not gaussian. Gaussian noise is easy, and that’s what I’m doing now until I fully understand how noise is transformed through the regression.
Another matter of complication is that regularizing (or denoising/smoothing) these fields is an active area of research. Extensions to the standard anisotropic edge-preserving filters like Perona-Malik are non-trivial (at least to me.) One of the technicalities of diffusion tensors is that they are positive definite. The positive definiteness is a physical manifestation as diffusion can only be zero at absolute zero (a great story for sci-fi.) I picked one of the many extensions just to test my workflow and here are the results. Pretty good I’d say for all the complications.

Lastly, opensource visualization tools seem to trip over the simplest of tasks. MayaVi seems to be the only one that can update the VTK pipeline when the source data changes. In other programs I have to rebuild the pipeline each time. As you can imagine, this gets tiring really fast.
