Re: using BAR Distribution plotter in a macro script

Posted by Aryeh Weiss on
URL: http://imagej.273.s1.nabble.com/using-BAR-Distribution-plotter-in-a-macro-script-tp5023555p5023559.html

Hi Jan,

Thank you for your immediate reply.


On 22/06/2020 18:27, Jan Eglinger wrote:

> 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
>
this works as advertised...
>
> > (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.
>
I was not able to get this to work, with either shift-left-click or
shift-right-click. I also tried control and alt with click.

I run ubuntu 20.04 (POP OS distribution) .I wonder if this function is
OS dependent.

Best regards

--aryeh

>
> 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
>>

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051

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