call function for IJ tool

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

call function for IJ tool

Tiago Ferreira
Hi,

I have to do a series of measurements with 'Analyze particles...' of a *subset*
of cells in random image fields.
So I wrote some simple macro that engulfs the cells I choose (4-5 per image)
in a oval selection just by point clicking over them.

But its not flexible enough.

So I realize that actually that 'brush' tool does this already (i.e., setting
a enough large size, shift clicking in distant points of the image makes
already multiple oval selections in a composite ROI);

But I fail to set the diameter of the brush tool in an interactive way:

So, if I have for e.g.:

// code ---
a=call("ij.Prefs.get","toolbar.brush.size","");
b=call("ij.Prefs.set","toolbar.brush.size",2*a);
a=call("ij.Prefs.get","toolbar.brush.size","");
print(a);
// code ---

I do change the brush but IJ does not recognize it, unless I double-click
on the tool.

Does anyone have a fix for this?

Thanks,

T.
Reply | Threaded
Open this post in threaded view
|

Re: call function for IJ tool

Wayne Rasband
> I have to do a series of measurements with 'Analyze particles...' of a
> *subset*
> of cells in random image fields.
> So I wrote some simple macro that engulfs the cells I choose (4-5 per
> image)
> in a oval selection just by point clicking over them.
>
> But its not flexible enough.
>
> So I realize that actually that 'brush' tool does this already (i.e.,
> setting
> a enough large size, shift clicking in distant points of the image
> makes
> already multiple oval selections in a composite ROI);
>
> But I fail to set the diameter of the brush tool in an interactive way:
>
> So, if I have for e.g.:
>
> // code ---
> a=call("ij.Prefs.get","toolbar.brush.size","");
> b=call("ij.Prefs.set","toolbar.brush.size",2*a);
> a=call("ij.Prefs.get","toolbar.brush.size","");
> print(a);
> // code ---
>
> I do change the brush but IJ does not recognize it, unless I
> double-click
> on the tool.
>
> Does anyone have a fix for this?

The 1.41o daily build adds a Toolbar.setBrushSize() method that macros
can call to set the size of the brush tool.

    a=call("ij.gui.Toolbar.getBrushSize");
    b=call("ij.gui.Toolbar.setBrushSize",2*a);
    a=call("ij.gui.Toolbar.getBrushSize");
    print(a);

Note that Toolbar.getBrushSize() returns 0 if the brush tool is not
enabled and Toolbar.setBrushSize() is not allowed to set the size to
less than 5.

-wayne