Align frames in .tiff file derived from 2d photon microscopy of rat brain

Each frame in the .tiff file is imaged at a certain depth of the brain. These frames are not aligned properly. I have so far used ImageJ plugins like MultiStackReg, Linear SIFT, TrackEM2 and such popular applications (mostly with rigid transformation). But, it does not seem effective in correcting the misalignment. I am new to Image processing and wondering if there are better tools for this purpose.
What are the steps to do such alignment with these plugins ? I read that rigid,affine and elastic transformations must be performed in that order. What are some other steps i am missing?

1 Like

Hi @imageproc,

Welcome to the forum.

It would help us understand your issue better if you gave more information, such as:

  • What do your images look like? Consider posting them here for us to see
  • What was it about the result that were inadequate? E.g. did the methods you try do nothing? Did they make the alignment better, but just still not good enough? or did they give completely garbage results?
  • What were the exact steps that you used for the various methods? Most of them have parameters that may need changing depending on the particular images to be aligned…

I read that rigid,affine and elastic transformations must be performed in that order.

This helps sometimes, but isn’t always necessary. It’s hard to give a recommendation without knowing more details about your images / goals.



@bogovicj thanks for your reply. One detail i have missed is that, the images are from a live animal, so there are motion artifacts. The field of view changes from one frame to the next as the microscope focuses deeper into the tissue along the z-axis.
The tools i have mentioned such as StackReg do not seem to align the frames at all. There is no visible changes in the transformed image stack. I have also tried to use IMART which focuses on stack alignment in vivo. But again, the output images still seem quite shaky and same as the input images.
Below is a GIF of the input .tif frames playing in succession.

The .gif files are uploading but not displayed in the post - not sure why ?

Hi @bogovicj
i could not attach the gif earlier.i think you can view the image now.

the tools i used (moco.jar, turboreg etc) do not seem to affect the images that much at all.I surmise that it maybe due to the fact that each one of the frames is from a different FOV, so the average template routine is not all that effective given that none of the frames are similar to any other?
For most of the Fiji plugins, i chose default parameters and Rigid transforms.


Hi, I tried to align your images by my plugin(CoordinateShift).

Is it like this?
(convert RGB to 8bit gray scale -> convert z to t -> gaussian 2 -> CoordinateShift sub pixel 10, without ROI(use all area))

And, is this image time lapse image?
If you want more accurate position correction, I think it is better to take several z stacks and correct the position based on the projected image and adapt it to the original image.


1 Like

@hwada thanks so much for the reply.No, this is not timelapse.Each frame is raster scanned (row after row) and each frame is taken along the axial slice of a brain cell.
I tried using your plugin ‘CoordinateShift’ in Fiji.If there’s documentation for the plugin,kindly point me to it.I am unable to follow the steps mentioned in your comment on my install(i don’t see the Gaussian option, for instance)

Hi, @imageproc

Thank you for your interest.
Installation is possible by copying the plugin file to the plugins directory in the FIJI application or by using the Plugins> Install plugin function.
First, the gif (RGB) image that was pasted was converted to a simple gray scale. (Using basic functions of Fiji, 8bit or 16bit)*This is an unnecessary step if the original image is so.
And, I converted z-axis to t-axis because my plug-in is based on time-lapse position correction.(Using basic functions of Fiji)
The same is true for other alignment plugins, but the alignment may not work as expected with the original image.For this reason, this time, it is solved simply by applying a Gaussian filter.(Using basic functions of Fiji)
Then, I run CoordinateShift(Plugins > HWada > CoordinateShift).
Please just click “Shift” button, the process will begin and the table will display the number of pixels moved.
I think it works pretty well, but there are times when we want to do a bit more precise position correction.
In this case, change the subpixel value to an appropriate value.(This time I set it to 10.)
Click the “Clear All” button to clear the contents of the previous shift.
Then, click again “Shift” button.
If you want to adapt to the image without the Gaussian filter, copy the data in this table. (Click once on the table and ctl + a or cmd + a-> ctl + c or cmd + c)
Next, once the image is closed, open the new image that skipped the filter step and launch CoordinateShift again.
Click in row-1 of the table and right-click. If you select past, the data you just copied is displayed in the table. Clicking the “Appy” button in this state shifts the image as shown in this table.

…I am sorry, the documentation is not complete.(There is only an old version in jar file. And in Japanese)
However, since there are no complicated settings, it will be understood if you use it.
This plug-in is designed to perform align(shift x, y only, not rotate and deflect) images for frames assuming multiple channels, multiple slices, and multiple frames. (time lapse image)
Please refer to the video of CoordinateShift site.


1 Like