Login  Register

Re: using BAR Distribution plotter in a macro script

Posted by Jan Eglinger on Jun 22, 2020; 3:27pm
URL: http://imagej.273.s1.nabble.com/using-BAR-Distribution-plotter-in-a-macro-script-tp5023555p5023557.html

Hi Aryeh,

I don't know if Tiago Ferreira (the author of BAR) is still following
this mailing list. In general I'd recommend asking questions on
https://forum.image.sc instead.

 > 2. How so I run any macro that is in a file from a macro?

Two options:

- (if you use Fiji) put your macro file (with an underscore in the name)
in a subfolder of /Fiji.app/scripts/ such as
/Fiji.app/scripts/MyMacros/dist_plot.ijm so that it'll show up in the
menus, then use a command such as:
     run("dist plot")

or

- use the runMacro() function:
https://imagej.net/developer/macro/functions.html#runMacro


 > (copied from github and
 > saved locally)

To open the source of a script in the script editor, you can also
shift-click on its menu entry.


Hope that helps,
Jan


On 22.06.20 16:13, Aryeh Weiss wrote:

> I am trying to use the distribution plotter in a macro script. Here is
> what the macro recorder provides me:
>
> run("Distribution Plotter", "parameter=Mean tabulate=[Number of values]
> automatic=[Specify manually below:] bins=50");
>
> However, if I run this, is tells me "Automatic binning could not be
> performed. Re-check settings or specify bins manually."
>
> I looked at the source code here:
> https://github.com/tferr/Scripts/blob/master/BAR/src/main/resources/scripts/BAR/Data_Analysis/Distribution_Plotter.ijm 
>
>
> and found that this message will happen with max-min is 0. This should
> not be the case assuming I have a results table open, and it does not
> happen when I run the script manually.
>
> So i tried to use a local copy of the script (copied from github and
> saved locally) so that i could add some print statements and try to
> figure out what is happening.
> The command I tried is
> run("script:/home/amw/Desktop/83411LightMicroscopyData/studentDataSets/distPlot.ijm",
> "parameter=Mean tabulate=[Number of values] automatic=[Specify manually
> below:] bins=415");
>
> However, this returns :
>
>      ---
>      <Error: java.io.FileNotFoundException:
> http://wsr.imagej.net/download/Examples/Macro/script:/home/amw/Desktop/83411LightMicroscopyData/studentDataSets/distPlot.ijm>
> in line 1:
>
>      var ; initializeSciJavaParameters ( ) ; run (
> "script:/home/amw/Desktop/83411LightMicroscopyData/studentDataSets/distPl...
>
>
> So I have two questions:
>
> 1. How do I run the Distribution plotter from a macro?
>
> 2. How so I run any macro that is in a file from a macro?
>
> I have a feeling that this second question maybe related to the use of
> BARlib, which I have not succeeded in figuring out -- I am missing some
> understanding of how that works. Maybe someone has a really simple
> example of how to use that.
>
> Thanks in advance\
> --aryeh
>

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