Posted by
Luis Isaac Ramos Garcia on
Jul 20, 2010; 8:34am
URL: http://imagej.273.s1.nabble.com/Problem-with-drawLine-tp3687544.html
Dear Colleges;
First, I am new with ImageJ and its macro language so sorry if this
is a not interesting.
I would like to draw a line in a centered image, i.e. the origin of
the coordinates is not the left upper corner instead is more or less the
center of the image.
The center is at (1182,963) in a 2369x1928 image.
When I tried the following lines the macro does not work:
setColor(255, 0, 0);
setLineWidth(1);
i=0;
x1=round((i-14)*(10/0.17));
y1=-750;
x2=x1;
y2=750;
drawLine(x1,y1,x2,y2);
Instead if I take the origin of the coordinates the left upper
corner the macro works:
setColor(255, 0, 0);
setLineWidth(1);
i=0;
x1=round((i-14)*(10/0.17));
y1=-750;
x2=x1;
y2=750;
drawLine(x1,y1,x2,y2);
But the if I change the 14 in the third line by 13....:
setColor(255, 0, 0);
setLineWidth(1);
i=0;
x1=round((i-13)*(10/0.17));
y1=-750;
x2=x1;
y2=750;
drawLine(x1,y1,x2,y2);
It does not work again.
At the end I suppose that there is a concept fail on the use of
drawLine but I don't know.
PD: I use i the code because in the next step I want to draw 29
lines in a 1cm step
Dear Colleges;
First, I am new with ImageJ and its macro language so sorry if this
is a not interesting.
I would like to draw a line in a centered image, i.e. the origin of
the coordinates is not the left upper corner instead is more or less the
center of the image.
The center is at (1182,963) in a 2369x1928 image.
When I tried the following lines the macro does not work:
setColor(255, 0, 0);
setLineWidth(1);
i=0;
x1=round((i-14)*(10/0.17));
y1=-750;
x2=x1;
y2=750;
drawLine(x1,y1,x2,y2);
Instead if I take the origin of the coordinates the left upper
corner the macro works:
setColor(255, 0, 0);
setLineWidth(1);
i=0;
x1=round((i-14)*(10/0.17));
y1=-750;
x2=x1;
y2=750;
drawLine(x1,y1,x2,y2);
But the if I change the 14 in the third line by 13....:
setColor(255, 0, 0);
setLineWidth(1);
i=0;
x1=round((i-13)*(10/0.17));
y1=-750;
x2=x1;
y2=750;
drawLine(x1,y1,x2,y2);
It does not work again.
At the end I suppose that there is a concept fail on the use of
drawLine but I don't know.
PD: I use "i" the code because in the next step I want to draw 29
lines, i. e. I would like to use these sentences in a for loop
Many Thanks,
--
Dr Luis Isaac Ramos Garcia
Departamento de Oncologia
Clinica Universidad de Navarra
Facultad de Medicina,Universidad de Navarra
Av. Pio XII nÂș36, 31008 Pamplona, Spain
Fax: +34 948255500
TEL: +34 948255400 (Ext. 4924)
E-mail:
[hidden email]
Web Page:
http://www.cun.es