Macro cannot change and keep options for "Point Tool"

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

Macro cannot change and keep options for "Point Tool"

AAM71
Dear Listers,

Sorry for so many questions but I am again having a problem.

If I use "Point Tool" (from ImageJ menu) manually I can set quite
successfully any type, color, size and other options (that you can see
after double clicking). If I try to repeat the same thing with macro
(after using Macro Record to get parameters names) then some settings
are reverted to default (type is always "hybrid", size is always
"small"), and options like "Add to overlay" or "Add to ROI Manager" do
not work.

Macro below demonstrates that:

newImage("New", "RGB ramp", 512, 512, 1);
setTool("point");
run("Point Tool...", "type=Hybrid color=Yellow size=Small add_to");
makePoint(118, 161);
makePoint(157, 258);
makePoint(203, 325);
run("Point Tool...", "type=Crosshair color=Red size=Large add_to");
makePoint(98, 161);
makePoint(137, 258);
makePoint(193, 325);


Sincerely,
Alex Mironov

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

Re: Macro cannot change and keep options for "Point Tool"

Wayne Rasband-2
> On Oct 30, 2018, at 12:28 PM, Aleksandr Mironov <[hidden email]> wrote:
>
> Dear Listers,
>
> Sorry for so many questions but I am again having a problem.
>
> If I use "Point Tool" (from ImageJ menu) manually I can set quite successfully any type, color, size and other options (that you can see after double clicking). If I try to repeat the same thing with macro (after using Macro Record to get parameters names) then some settings are reverted to default (type is always "hybrid", size is always "small"), and options like "Add to overlay" or "Add to ROI Manager" do not work.

The makePoint() macro function in the latest ImageJ daily build (1.52i21) has an optional options argument that can be used to specify the type, size and color of the point. The point is added to the overlay if the options string contains the word ‘add’. Here is an example:

  newImage("New", "RGB ramp", 512, 512, 1);
  makePoint(80, 80, "tiny yellow hybrid add");
  makePoint(118, 161, "small yellow hybrid add");
  makePoint(157, 250, "large yellow hybrid add");
  makePoint(203, 325, "extra large yellow hybrid add");
  makePoint(60, 80, "tiny red cross add");
  makePoint(90, 161, "small red cross add");
  makePoint(130, 250, "large white circle add");
  makePoint(170, 325, "extra large cyan dot add”);

And here is a JavaScript version:

  img = IJ.createImage("New", "8-bit ramp", 500, 500, 1);
  img.setRoi(new PointRoi(80, 80, "tiny yellow hybrid add"));
  img.setRoi(new PointRoi(118, 161, "small yellow hybrid add"));
  img.setRoi(new PointRoi(157, 250, "large yellow hybrid add"));
  img.setRoi(new PointRoi(203, 325, "extra large yellow hybrid add"));
  img.setRoi(new PointRoi(60, 80, "tiny red cross add"));
  img.setRoi(new PointRoi(90, 161, "small red cross add"));
  img.setRoi(new PointRoi(130, 250, "large white circle add"));
  img.setRoi(new PointRoi(170, 325, "extra large cyan dot add"));
  img.show();

-wayne


> Macro below demonstrates that:
>
> newImage("New", "RGB ramp", 512, 512, 1);
> setTool("point");
> run("Point Tool...", "type=Hybrid color=Yellow size=Small add_to");
> makePoint(118, 161);
> makePoint(157, 258);
> makePoint(203, 325);
> run("Point Tool...", "type=Crosshair color=Red size=Large add_to");
> makePoint(98, 161);
> makePoint(137, 258);
> makePoint(193, 325);

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

Re: Macro cannot change and keep options for "Point Tool"

AAM71
Thank you Wayne!

Sincerely,
Alex

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