Login  Register

Re: correcting a constant drift in a image stack

Posted by Wayne Rasband on Mar 17, 2009; 8:14pm
URL: http://imagej.273.s1.nabble.com/correcting-a-constant-drift-in-a-image-stack-tp3693137p3693138.html

On Mar 17, 2009, at 11:34 AM, Wes wrote:

> Hi all,
>
> I have a series of images (600) that have a constant drift of 1/30 of a
> pixel between frames. I have tried various align plugins but none seem
> to work.
> This doesn't surprise me because the main object in the images changes.
>
> Is there a way I can do an incremental translation to the images?
> For example...
> Translate image1 by 1x0.0333 in x
> Translate image2 by 2x0.0333 in x
> Translate image3 by 3x0.0333 in x
> Translate image4 by 4x0.0333 in x

Here is a macro that will correct for the drift:

   requires("1.42l");
   setBatchMode(true);
   drift = 0.0333;
   offset = 0;
   for (i=1; i<=nSlices; i++) {
      setSlice(i);
      offset += drift;
      run("Translate...", "interpolation=Bicubic slice y=0 x="+offset);
   }

It requires the v1.42l daily build, which updates the Image>Translate
command to work with sub-pixel offsets. V1.42l also adds a Bicubic
interpolation option to the Translate, Scale, Rotate and Adjust>Size
commands. The bicubic interpolation method used is from Chapter 16 of
"Digital Image Processing: An Algorithmic Introduction Using Java" by
Wilhelm Burger and Mark Burge. The 'a' control parameter is set to 0.5
(Catmull-Rom interpolation). You can update to the daily build by using
the Help>Update ImageJ command and selecting "daily build" from the
drop down menu.

-wayne