Research Update 2015-05-22

We are attempting to find information about the flow of calcium. We will outline the method being used (for now) below. Following the outline I will examine it with simple test cases. I will use a simple 3D gaussian function to represent calcium concentrations. By shifting the guassian around to different locations we can simulate the notion of calcium movement within successive frames. We will take this foundation and construct different scenarios to explore the limits of the method. For example we will look at both wave like and diffusion like processes

  • The "slow" wave case where the gaussian is kept at constant amplitude and is translated only slightly
  • The "fast" wave case where the gaussian is kept at constant amplitude and is translated significantly
  • The "slow" diffusion case where the gaussian's amplitude is reduced while translating only slightly
  • The "fast" diffusion case where the gaussian's amplitude is reduced while translating it significantly.
  • All of the above cases with added noise.

If we can detect or approximate the "flow" i.e. which direction the gaussian moved to in these cases, then I will move on to more complicated test cases such as adding noise and multiple gaussians, etc.

Outline of the Method

We will approximate the flow within 5 frames at a time: $F_1,F_2,F_3,F_4,F_5$. The steps are enumerated below.

Spatial Denoising

  • Transform all 5 frames into the frequency domain via the Discrete Cosine Transform$^1$ $$\hat{F}_i = \text{DCT}(F_i)$$
  • Remove some of the higher modes with lower power to mitigate the influence of noise in the original signal. Practically, this translates to setting them equal to zero. $$\hat{F}_i[m_x: \hspace{3pt},m_y:] = 0$$ where the $m_x$ and $m_y$ are the locations where we truncate the modes.

Temporal Denoising

  • Still within the frequency domain we take a temporal average of the first 3 frames $\tilde{F}_2 = \frac{\hat{F}_1+\hat{F}_2+\hat{F}_3}{3}$ and the last three frames $\tilde{F}_4 = \frac{\hat{F}_3+\hat{F}_4+\hat{F}_5}{3}$. This averaging also "slows" down fast processes. This should help in the test cases where we examine fast diffusion and waves.

Temporal Derivative

  • Then we take the difference between these spatially denoised and temporally avergaed frames to approximate the temporal derivative. $$\frac{\partial \hat{F}_3}{\partial t} \approx \tilde{F}_4 - \tilde{F}_2$$

Fit a Surface

  • Then we transform back into cartesian space with the inverse DCT $$\frac{\partial F_3}{\partial t} \approx \text{DCT}^{-1}(\frac{\partial \hat{F}_3}{\partial t})$$
  • We down-sample the image for computational efficiency
  • Then fit it with a two dimensional cubic interpolant. We now have a smoothed, continuous ($C^1$ to be precise) representation of the temporal derivative.

Determine Flow

  • We then calculate the gradient of the temporal derivative which gives us our first approximation to the flow. This vector field is the union of the "correct" flow along with artifacts of the method. $$ \nabla \frac{\partial F_3}{\partial t}(x,y) \approx \bigg< \frac{\partial F_3}{\partial x \partial t}(x,y), \frac{\partial F_3}{\partial y \partial t}(x,y) \bigg>$$
  • To remove the artifacts we only keep the vectors whose magnitudes constitute the top 15% (this may need to be localized and not global)
  • Then only keep those vectors whose tails and heads have opposite signs on the approximate temporal derivative. For example, the vectors at location $x,y$ that we keep satisfy the following criteria. $$\nabla \frac{\partial F_3}{\partial t}\bigg (\frac{\partial F_3}{\partial x \partial t}(x,y), \frac{\partial F_3}{\partial y \partial t}(x,y) \bigg) * \nabla \frac{\partial F_3}{\partial t}(x,y) < 0 $$

Test Case 1: Slow Wave-like Movement

First we take a Gaussian and translate is over 5 frames a small distance. Such a Gaussian and its movement is shown below. We see the 5 2D plots below And also the 5 3D plots

  • First we transform into the frequency domain. We show the modes of frame 0 below. As expected, there is no noise becasue the signal was constructed directly from a gaussian

  • Normally we would remove some of the higher modes, but we will skip that here since there is no noise.
  • Next we average the first 3 and last 3 modes. We show the averages in both 2D and 3D for each set of frames below

Average of $F_1,F_2,F_3$

Average of $F_3,F_4,F_5$

  • Now we approximate the temporal derivative by taking the difference of these two averages

  • Currently, the above is a discrete approximation to the temporal derivative. However, piecewise continuous representation would be more amenable to analysis. So, we do this next. For computational efficiency we first downsample the discrete approximation and then fit it with a $C^1$ piecewise cubic interpolant.

  • The last step of this first general algorithm is to calculate the gradient$^2$ of the temporal derivative. This vector field will have information about the flow, along with other vectors arrising as an artifact of the method

This concludes the general algorithm used to procure the gradient vector field. It is my contention so far, that provided the input data meets certain criteria this vector field will have embedded in it, flow information.

Some Thoughts

  • What is this criteria that the data must meet? We currently to not know for certain, but it is becoming more clear the more experiments we run. So far there are two main requirements.
    1. We must be able to express the calcium concentrations "roughly" as a linear combination of Gaussians
    2. The calcium dynamics must be "slow enough" to be captured in the temporal averaging.
  • Also, I do not yet believe I can determine any actual velocity information from this technique, only direction.

Extracting the Flow Information

This is the part I am currently working on. I have a few ideas on this which I am trying out.

  1. Longest Vector - My first idea is to only look at the longest vectors. This is because the orientation of a gradient vector is always pointing in the direction of steepest ascent, and provided the calcium dynamics are "slow enough" when the pseudo-gaussian moves the difference will always look like the temporal derivative above and the direction of steepest ascent is always in the direction of motion.

    • Taking the above gradient field and using this technique we were able to succesfully extract the flow information in this simple example...

    • Finally, I can average these "longest" vectors to get a good approximation of the flow in the region.

    • To improve this, I want to exploit some of our knowledge about the spatial dynamics of calcium. For example, if we get an increase in calcium intensity in one location and we were to circumscribe it with a circle (still assuming it is gaussian) what would be the radius of that circle? If we know this, I believe I can more reliably extract the flow information as follows...

      1. Create a sliding window of radius $r$ and let it pass over the entire dataset.
      2. At each location take the top ~$2\%$ longest vectors.
      3. I believe the vectors within the union of these subsets will be a better approximation to the flow, in the presence of noise and more gaussians.

Test Case 2: Slow Wave-like Movement with 10% Noise

  • Here is the original data to be processed

  • Next we look at the modes of frame 2 as an example

  • Now we remove the noise. Below is a plot of the truncated modes

  • Now the denoised temporal averages look nicer Average of $F_1,F_2,F_3$

Average of $F_3,F_4,F_5$

  • Approximate the derivative as before

  • We down sample, and fit a surface to get our smoothed/denoised approximation of the signal

  • Below is the gradient of the temporal derivative

  • The "Longest Vectors"

  • And finally the average of the longest vectors, the flow.

TSeries-01292015-1540_site3_0.75ISO_AL_frame_40 Data

To get a feel for what things look like so far here is my method applied to the above data

Test Case 2: Slow Wave-like Movement with 10% Noise

  • Here is the original data to be processed (looks like grass...)

  • Next we look at the modes of frame 2 as an example of the noise in the data

  • Now we remove the noise. Below is a plot of the truncated modes

  • Now the denoised temporal averages. Doesn't help much. May need a wider average Average of $F_1,F_2,F_3$

Average of $F_3,F_4,F_5$

  • Approximate the derivative as before

  • We down sample, and fit a surface to get our "smoothed/denoised" approximation of the signal

  • Below is the gradient of the temporal derivative

  • The "Longest Vectors"

  • T average of the longest vectors

Footnotes

  • $^1$ Discrete Cosine Transform
    • Mathematically the image is transformed as follows $$X_{k_1,k_2}=\sum_{n_1=0}^{N_1-1} \sum_{n_2=0}^{N_2-1} x_{n_1,n_2} \cos \bigg [ \frac{\pi}{N_1}(n_1+\frac{1}{2})k_1 \bigg ] \cos \bigg [ \frac{\pi}{N_2}(n_2+\frac{1}{2})k_2 \bigg ] \hspace{10pt} k_1 = 1,...,N_1-1, \hspace{5pt} k_2 = 1,...,N_2-1$$
  • $^2$ Gradient
    • Given our approximating function $f(x,y)$, the gradient is as follows $$\nabla f(x,y) = \bigg < \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y} \bigg >$$