Align time series based on center of mass

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Align time series based on center of mass

racoliveira
Hello,

i'm working on 2D time series and wonder if there is a simple way to automatically center each slice of the stack using the XY coordinates of the center of mass of that slice (to align the stack).
I have already tried StackReg but it doens't allways correct very well *particularly when there is fast movements in the sample).


Thank you very much for your help,

Raquel
Reply | Threaded
Open this post in threaded view
|

Re: Align time series based on center of mass

Winnok H. De Vos
Dear

The macro below will do a simple translational image registration,  
based on the intensity center of the entire image. Note, however, that  
this type of registration will be strongly biased by parts of the  
image that do not belong to your object of interest. One way to  
circumvent this is to first segment your objects of interest and clear  
outside these regions. This may also be the reason why stackReg  
doesn't work well for your images. I found StackReg to outperform most  
other methods for 2-dimensional purposes.
Regards,

Winnok

macro "Register by Translation"{
        setBatchMode(true);
        run("Clear Results");
        title=getTitle;selectWindow(title);nz=nSlices;
        run("Set Measurements...", "center redirect=None decimal=4");
        for(i=1;i<=nz;i++){
                selectWindow(title);setSlice(i);
                run("Measure");
                x=getResult("XM",i-1);y=getResult("YM",i-1);
                if(i==1){x0=x;y0=y;}
                sx=x0-x;sy=y0-y;
                run("Translate...", "x="+sx+" y="+sy+" slice");
        }
        selectWindow(title);
        rename("translated "+title);
        setBatchMode("exit and display");
}




________________
Research assistent

Dept. Molecular Biotechnology
University of Ghent
Coupure links 653
9000 Gent, Be

tel. 0032(0)92645971
fax. 0032(0)92646219


Citeren racoliveira <[hidden email]>:

> Hello,
>
> i'm working on 2D time series and wonder if there is a simple way to
> automatically center each slice of the stack using the XY coordinates of the
> center of mass of that slice (to align the stack).
> I have already tried StackReg but it doens't allways correct very well
> *particularly when there is fast movements in the sample).
>
>
> Thank you very much for your help,
>
> Raquel
> --
> View this message in context:  
> http://n2.nabble.com/Align-time-series-based-on-center-of-mass-tp2410924p2410924.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>