Issue with changing polyline linewidth in a macro

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

Issue with changing polyline linewidth in a macro

Pierre1981
Hello,
 
I know this topic has been discussed already, but for some reasons, solutions proposed do not work in my code.
 
I have a polyline selection made on a stack, and I would like to change the linewidth of this selection.
 
What I tried so far is:
 
chosen_linewidth = getNumber("type a linewidth:", chosen_linewidth);
run("Line Width...", chosen_linewidth);
 
Whatever I give as a value for "chosen_linewidth", the actual width of the line on the stack is not changing.
 
I tried
run("Line Width...", "line=5");
which has been proposed some time ago on a similar problem, but it did not help.
 
If I write
run("Line Width...");
I am asked for a linewidth, which is then nicely reported on the linewidth scalebar, but no effect on the polyline in the stack.
 
On the other hand, outside of the macro, by clicking on the same scalebar, it does change the linewidth on the image.
 
Does anyone have an idea to push ImageJ to change the linewidth of the selection?
 
Kind regards,
Pierre
Reply | Threaded
Open this post in threaded view
|

Re: Issue with changing polyline linewidth in a macro

Krs5
Hi Pierre,

As far as I remember run("Line Width...", "line=5"); works only before you draw your line, not after the line has been drawn.

What probably will work is to add the ROI to the ROI manager and use:
roiManager("Set Line Width", 10);

Best wishes

Kees

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Pierre1981
Sent: 10 January 2013 08:22
To: [hidden email]
Subject: Issue with changing polyline linewidth in a macro

Hello,
 
I know this topic has been discussed already, but for some reasons, solutions proposed do not work in my code.
 
I have a polyline selection made on a stack, and I would like to change the linewidth of this selection.
 
What I tried so far is:
 
chosen_linewidth = getNumber("type a linewidth:", chosen_linewidth); run("Line Width...", chosen_linewidth);
 
Whatever I give as a value for "chosen_linewidth", the actual width of the line on the stack is not changing.
 
I tried
run("Line Width...", "line=5");
which has been proposed some time ago on a similar problem, but it did not help.
 
If I write
run("Line Width...");
I am asked for a linewidth, which is then nicely reported on the linewidth scalebar, but no effect on the polyline in the stack.
 
On the other hand, outside of the macro, by clicking on the same scalebar, it does change the linewidth on the image.
 
Does anyone have an idea to push ImageJ to change the linewidth of the selection?
 
Kind regards,
Pierre



--
View this message in context: http://imagej.1557.n6.nabble.com/Issue-with-changing-polyline-linewidth-in-a-macro-tp5001350.html
Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with changing polyline linewidth in a macro

Pierre1981
Hi Kees,

Thank you very much for your answer, it works!

For the ones who would need it:

/*********************************************/

chosen_linewidth = getNumber("type a linewidth:", chosen_linewidth);
roiManager("add");
roiManager("Set Line Width", chosen_linewidth);

/*********************************************/

Thanks again!
Pierre