Login  Register

Re: Macro vs. Script, where to start

Posted by Kenneth Sloan-2 on Oct 10, 2019; 2:06pm
URL: http://imagej.273.s1.nabble.com/Macro-vs-Script-where-to-start-tp5022518p5022520.html

Allow me to suggest an alternative: full Java.

I am old school and make do without an IDE, but it works for me.  I’ll let
someone else suggest an IDE to use with Java and ImageJ.

On Thu, Oct 10, 2019 at 08:48 Michael Schmid <[hidden email]>
wrote:

> Hi Rainer,
>
> of course, the first thing to try is the macro recorder in JavaScript mode.
>
> Script languages call the Java API, so you have to look up the functions
> there.
>
> Starting points:
>
> - For run(...) functions, it is simply IJ.run, which can also take an
> ImagePlus argument to specify on which image to run the function. The
> ImagePlus is essentially what an image (with ImageID) is in macros, and
> it can hold a single image or stack.
> Each ImagePlus has an ImageProcessor, which just holds the data (if a
> stack, of the current slice), but no spatial calibration, etc.
>
> - Many ImageJ macro functions have an equivalent in IJ.java.
>
> - If I know the macro command and not the java code, usually I search
> for the code that executes the macro functions in:
>    https://github.com/imagej/imagej1/blob/master/ij/macro/Functions.java
>
> For more complex functions like, e.g. the Plot.??? functions, there is a
> dispatch function, in this case doPlot(), and then the actual code is in
> separate functions called by doPlot(), such as setPlotColor().
>
> hth,
>
> Michael
> ________________________________________________________________
> On 10.10.19 13:47, Rainer M. Engel wrote:
> > I'm not a developer by profession, but became more and more accustomed
> > to it over the years. I started with small macros and want to sum up,
> > what is/was making this language attractive for the use within ImageJ.
> >
> >
> > Macro-Language:.......................................................
> > Macros can be recorded inside of ImageJ Plugins>Macros>Record and
> > extended by some logic found here:
> > https://imagej.nih.gov/ij/developer/macro/macros.html
> >
> > Using Fiji's script editor for macros helps you finding the right
> > function you may need, at least to the same extend useful to me is this
> > overview with all built-in functions:
> > https://imagej.nih.gov/ij/developer/macro/functions.html
> >
> >
> > Script-Languages:.....................................................
> > To automate things inside of ImageJ the Recorder (see above) can be
> > changed to output a desired language.
> > There are many examples available within the script editor of Fiji under
> > "Templates", or on other ImageJ/Fiji related websites and to some extent
> > the interactive search bar helps to find these.
> >
> > What I'm missing is some method overview like the macro language offers
> > for it's functions to make a text search, because often you know what to
> > achieve but you miss the spelling of a potential method/function.
> >
> > What IDE you would recommend for Jython, where I can see all available
> > methods of imported classes like Fiji's script editor is providing for
> > the macro language?
> >
> > Are there resources (easily searchable) to find fitting methods of
> > classes closely related to ImageJ or how do you achieve finding these?
> >
> >
> > Thank you in advance and I hope this will help others as well..
> >
> > Kind regards,
> > Rainer
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
--
-Kenneth Sloan

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