Friday, September 20, 2013

Image alignment with ecc

Ok, so I had this idea to align all the images across trials, so that I could run ICA on a concatendated stack, and thus get the same ICs for an entire experiment.

So I found ecc, some image registration algorithm, and it works pretty well.

I've been playing with it as a motion correction algorithm too, and it detects the sub-pixel movements pretty well. ecc is just a registration algorithm, so my motion correction is just registering each frame to the first frame.

The result is a 2x3xNFrames matrix that is the affine transform. Then I can plot the values of the matrix over time to see what kind of motion there is.

So like the far right column is the translational component, and the others is like a rotation/scaling matrix. The motion is quite subtle, but clearly it is there.

Then you can kind of see how the ganglion moves with a picture like this:
The numbers on this axis are pixel values. So this is very subtle movement (that's why its hard to see by eye). The big circle is the start pont. There are two traces -- a black and blue, which indicate the rotational/scaling aspects in their seperation.

Yeah, so this works pretty well, and it looks like it helps quite a bit.

One of the problems is that the edges of the image get strange, so the final result has to be clipped at the edges. This is easy to do: we just have to find the largest distance in the transform (for motion its usually sub-pixel) and round up to nearest pixel. Then take away that many pixels from the border.

This is x120516-t6, which was pretty scary motion, and changes the shortening response quite significantly:




No comments:

Post a Comment