macro:plot_zeroed_tracking_data
//Plot tracking data from a results table zeroed
//The required format is as generated by the Manual Tracking plugin
//http://rsbweb.nih.gov/ij/plugins/track/track.html
//assuming Results table column headings: Track > Slice > X > Y
//some variables
Track = 0;
result = 1;
//Plot the graph
Plot.create("Scatter Plot", "X", "Y");
//You may want to determine your own limits in some way here
Plot.setLimits(-250, 250, -250, 250);
//Get number of tracks
for (a=0; a<nResults(); a++) {
if (getResult("Track",a)>Track)
{
Track = getResult("Track",a);
}
else{};
}
//Work though the data a track at a time
for (b=1; b<(Track+1); b++)
{
x = newArray();
y = newArray();
//get first x and y value
x_0 = getResult("X", result);
y_0 = getResult("Y", result);
for (i=result; i<nResults; i++){
if (getResult("Track",i)==b) {
x1 = (getResult("X", i)) - x_0;
x = Array.concat(x, x1);
y1 = (getResult("Y", i)) - y_0;
y = Array.concat(y, y1);
result++;
//Plot each track
Plot.setColor("red");
Plot.add("crosses", x, y);
Plot.setColor("darkGray");
Plot.add("lines", x, y);
}
}
}
//Richard Mort 26/01/2013
macro/plot_zeroed_tracking_data.txt ยท Last modified: 2019/04/12 13:13 by 127.0.0.1