On Oct 15, 2014, at 9:54 AM, BenDehap wrote:
> Hello,
>
> I'm new on imageJ programming and my problem is the following :
>
> I have a list of coordinates for two points (A and B) that define a line
> over time :
> t=0sec : xA0, yA0 and xB0 and yB0 ;
> t=1sec : xA1, yA1 and xB1 and yB1 ; ... and so on until 150sec.
>
> This list is in a .txt file that i can modify using excel.
>
> So now i want to use those points to draw a selection line that will be
> specified at each time point during the movie (list of ROI in the ROI
> manager maybe).
>
> Could you guide me to a tutorial section that will allow me to create a
> macro like this? Or directly show me the way to do it?
Use the File>Import>Results command to open the coordinates as a Results table and then, for each row in the table, extract the coordinates, create a line selection and add it to an overlay. The following macro does this except it creates the Results table from coordinates stored in arrays.
-wayne
x1 = newArray(47,56,60,101,128,171,200,205,203,195);
y1 = newArray(187,199,216,242,287,313,337,374,397,413);
x2 = newArray(315,329,320,335,343,325,347,351,329,273);
y2 = newArray(47,75,131,177,207,266,324,395,451,479);
n = x1.length;
run("Clear Results");
for (i=0; i<n; i++) {
setResult("x1", i, x1[i]);
setResult("y1", i, y1[i]);
setResult("x2", i, x2[i]);
setResult("y2", i, y2[i]);
}
updateResults;
newImage("Untitled", "8-bit black", 500, 500, 10);
for (i=0; i<n; i++) {
x1 = getResult("x1", i);
y1 = getResult("y1", i);
x2 = getResult("x2", i);
y2 = getResult("y2", i);
setSlice(i+1);
makeLine(x1, y1, x2, y2);
Overlay.addSelection;
Overlay.setPosition(i+1);
}
run("Select None");
doCommand("Start Animation [\\]");
> --
> View this message in context:
http://imagej.1557.x6.nabble.com/Time-lapse-line-selection-tp5010058.html> Sent from the ImageJ mailing list archive at Nabble.com.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html