|
Hallo everybody!!
I was wondering if anyone can help me with a little problem I am facing (and that has been making me go nuts with programming!).
Me and a friend of mine, both with very limited programming skills, have written a macro for the program to do the following things:
1) I draw a line on top of the cell membrane I want to measure.
2) the program draws a small line perpendicular to the line I have drawn
3) it measures the pixel intensity along this small line. (in my normal cell case, the majority of the pixels are located close to the center of the small line)
4) the program waits me do to an action (which will be saving the data I got from the plot profile)
5) the program starts looping and draw another small line, measure the pixel intensity, and so on
Until here everything is miraculously working with our little macro we wrote. The problem is that, unfortunately, not all the cell membranes I have to measure are straight. when I have a line that the angle is not zero (i dont know if I am explaining this correctly, so I have attached an example), what happens is that the small lines that the program draws automatically are not going to be 90 degrees perpendicular to the line i drew
what I need to add to the macro would be:
if the drawing line is not straight, draw lines that have a 90 degree angle to the drawn line (guide line)
or
always draw lines that have a 90 degree angle to the drawn line (guide line)
This is the macro we have wrote:
inc = 10;
run("Fit Spline", "straighten");
wait(2000);
getSelectionCoordinates(x, y);
for (i=0; i<x.length; i+=inc) {
makeLine(x[i]-inc, y[i]-inc, x[i]-inc, y[i]+inc);
run("Plot Profile");
waitForUser;
run("Close");
run("Add Selection...");
}
<nabble_img src="lines.jpg" border="0" class="center"/>
If someone could help me, it would be AWESOME!
Thank you very much for your time!
|