setting selection line-width from a macro

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

setting selection line-width from a macro

Martin Höhne
Dear All,

I want to convert a segmented-line into an area, and repeat this for different line witdths (of the same original segmented line). I can do this manually, but I fail doing this from a macro. Below is a macro which I thought would do this, but it fails. All created areas have the same size.
What am I missing?

Thanks
Martin

-------
run("Dot Blot (7K)");
makeLine(482,48,387,125,246,90,156,175,67,143,54,223);
roiManager("Add");

for (i=1; i<33; i=i+10) {
        roiManager("Select", 0);
        run("Line Width...", "line="+i);
        run("Line to Area");
        roiManager("Add");
}
roiManager("Show All");
Reply | Threaded
Open this post in threaded view
|

Re: setting selection line-width from a macro

Rasband, Wayne (NIH/NIMH) [E]
> On Mar 24, 2015, at 11:31 AM, Martin Höhne <[hidden email]> wrote:
>
> Dear All,
>
> I want to convert a segmented-line into an area, and repeat this for
> different line witdths (of the same original segmented line). I can do this
> manually, but I fail doing this from a macro. Below is a macro which I
> thought would do this, but it fails. All created areas have the same size.
> What am I missing?

The Edit>Options>Line Width… command does not change the width of existing lines. Use Roi.setStrokeWidth(w) instead of run("Line Width...", "line="+w).

-wayne

  run("Dot Blot (7K)");
  run("Line Width...", "line=1");
  makeLine(482,48,387,125,246,90,156,175,67,143,54,223);
  roiManager("Add");
  for (i=1; i<33; i=i+10) {
     roiManager("Select", 0);
     Roi.setStrokeWidth(i);
     run("Line to Area");
     roiManager("Add");
  }
  roiManager("Show All");

> -------
> run("Dot Blot (7K)");
> makeLine(482,48,387,125,246,90,156,175,67,143,54,223);
> roiManager("Add");
>
> for (i=1; i<33; i=i+10) {
> roiManager("Select", 0);
> run("Line Width...", "line="+i);
> run("Line to Area");
> roiManager("Add");
> }
> roiManager("Show All");
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/setting-selection-line-width-from-a-macro-tp5012135.html
> Sent from the ImageJ mailing list archive at Nabble.com.



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

Re: setting selection line-width from a macro

Martin Höhne
In reply to this post by Martin Höhne
Thanks Wayne.
Works perfectly now!