ImageJ Macro Interpreter

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

ImageJ Macro Interpreter

Pasan Karunaratne
Hello everyone,

Can someone tell me what classes and methods are involved in the
interpretation of ImageJ Macros?

i.e. What method decodes lines such as run("smoothen") and calls the
corresponding function related to the parameter in quotes?

Thanks
Pasan.

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

Re: ImageJ Macro Interpreter

Michael Schmid
Hi Pasan,

the macro 'run' commands are the equivalent to 'ij.IJ.run' in Java.
IJ.run calls the plugin associated to the menu command; type Ctrl-L and select "Show full information" to see what the plugin is exactly named.
(note that most internal ImageJ commands also use plugins, just like the plugins that you can write yourself, but these plugins are intrinsic, i.e. contained in the ij.jar file).

E.g., IJ.run("Smooth") calls ij.plugin.filter.Filters("smooth"). The argument "smooth" is passed to the plugin in its setup method as the 'arg' String, to tell it which operation to perform. Many Plugins don't need an 'arg'; they do only one function.

The java code for most other macro commands (those without 'run'; except for the macro language elements such as for loops, variable assignment, etc.) is in ij.macro.Functions.

Michael
________________________________________________________________
On Jun 20, 2012, at 11:09, Pasan Karunaratne wrote:

> Hello everyone,
>
> Can someone tell me what classes and methods are involved in the
> interpretation of ImageJ Macros?
>
> i.e. What method decodes lines such as run("smoothen") and calls the
> corresponding function related to the parameter in quotes?
>
> Thanks
> Pasan.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

Re: ImageJ Macro Interpreter

Pasan Karunaratne
@Wayne, Michael

Loads of thanks for your replies. Got the code to work. :-)

I'm facing a different problem now.

In the binary version of ImageJ (i.e. not built from source), the macro
recorder displays recorded macros as

*makeRectangle(27, 76, 137, 60);*
*run("Smooth");*

However, in the git cloned version
(git://github.com/imagej/imagej.gitmaster branch) of
ImageJ, the output of the macro recorder is quite different. I can get
extremely complex and granular recordings, but none that simply call the
required function.

For example the output for running "Smooth" is


*ModuleExecutedEvent*
*  >> Module: imagej.core.plugins.convolve.SharpenDataValues*
*    imageDisplayService =
imagej.data.display.DefaultImageDisplayService@115126e {ImageDisplayService}
*
*    overlayService =
imagej.data.display.DefaultOverlayService@10c6cfc {OverlayService}
*
*    display = imagej.data.display.DefaultImageDisplay@21b42f {ImageDisplay}
*
*ModulePostprocessEvent*
*ModulePostprocessEvent*
*ModuleFinishedEvent*

*
*
I am looking into the SwingScriptRecorder class. Is there any other class I
should be checking out?

Further, the cloned version seems to be quite buggy. Am I using the correct
repository?

Do you know how I can get the short and sweet output of the binary version
in the macro recorder?



On Thu, Jun 21, 2012 at 2:11 PM, Michael Schmid <[hidden email]>wrote:

> Hi Pasan,
>
> the macro 'run' commands are the equivalent to 'ij.IJ.run' in Java.
> IJ.run calls the plugin associated to the menu command; type Ctrl-L and
> select "Show full information" to see what the plugin is exactly named.
> (note that most internal ImageJ commands also use plugins, just like the
> plugins that you can write yourself, but these plugins are intrinsic, i.e.
> contained in the ij.jar file).
>
> E.g., IJ.run("Smooth") calls ij.plugin.filter.Filters("smooth"). The
> argument "smooth" is passed to the plugin in its setup method as the 'arg'
> String, to tell it which operation to perform. Many Plugins don't need an
> 'arg'; they do only one function.
>
> The java code for most other macro commands (those without 'run'; except
> for the macro language elements such as for loops, variable assignment,
> etc.) is in ij.macro.Functions.
>
> Michael
> ________________________________________________________________
> On Jun 20, 2012, at 11:09, Pasan Karunaratne wrote:
>
> > Hello everyone,
> >
> > Can someone tell me what classes and methods are involved in the
> > interpretation of ImageJ Macros?
> >
> > i.e. What method decodes lines such as run("smoothen") and calls the
> > corresponding function related to the parameter in quotes?
> >
> > Thanks
> > Pasan.
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: ImageJ Macro Interpreter

Rasband, Wayne (NIH/NIMH) [E]
On Jun 21, 2012, at 5:43 AM, Pasan Karunaratne wrote:

> @Wayne, Michael
>
> Loads of thanks for your replies. Got the code to work. :-)
>
> I'm facing a different problem now.
>
> In the binary version of ImageJ (i.e. not built from source), the macro
> recorder displays recorded macros as
>
> *makeRectangle(27, 76, 137, 60);*
> *run("Smooth");*
>
> However, in the git cloned version
> (git://github.com/imagej/imagej.gitmaster branch) of
> ImageJ, the output of the macro recorder is quite different. I can get
> extremely complex and granular recordings, but none that simply call the
> required function.
>
> For example the output for running "Smooth" is
>
>
> *ModuleExecutedEvent*
> *  >> Module: imagej.core.plugins.convolve.SharpenDataValues*
> *    imageDisplayService =
> imagej.data.display.DefaultImageDisplayService@115126e {ImageDisplayService}
> *
> *    overlayService =
> imagej.data.display.DefaultOverlayService@10c6cfc {OverlayService}
> *
> *    display = imagej.data.display.DefaultImageDisplay@21b42f {ImageDisplay}
> *
> *ModulePostprocessEvent*
> *ModulePostprocessEvent*
> *ModuleFinishedEvent*
>
> *
> *
> I am looking into the SwingScriptRecorder class. Is there any other class I
> should be checking out?
>
> Further, the cloned version seems to be quite buggy. Am I using the correct
> repository?

You are using the ImageJ2 Git repository (https://github.com/imagej/). The ImageJ repository is at

    http://fiji.sc/imagej.git

-wayne


> Do you know how I can get the short and sweet output of the binary version
> in the macro recorder?
>
>
>
> On Thu, Jun 21, 2012 at 2:11 PM, Michael Schmid <[hidden email]>wrote:
>
>> Hi Pasan,
>>
>> the macro 'run' commands are the equivalent to 'ij.IJ.run' in Java.
>> IJ.run calls the plugin associated to the menu command; type Ctrl-L and
>> select "Show full information" to see what the plugin is exactly named.
>> (note that most internal ImageJ commands also use plugins, just like the
>> plugins that you can write yourself, but these plugins are intrinsic, i.e.
>> contained in the ij.jar file).
>>
>> E.g., IJ.run("Smooth") calls ij.plugin.filter.Filters("smooth"). The
>> argument "smooth" is passed to the plugin in its setup method as the 'arg'
>> String, to tell it which operation to perform. Many Plugins don't need an
>> 'arg'; they do only one function.
>>
>> The java code for most other macro commands (those without 'run'; except
>> for the macro language elements such as for loops, variable assignment,
>> etc.) is in ij.macro.Functions.
>>
>> Michael
>> ________________________________________________________________
>> On Jun 20, 2012, at 11:09, Pasan Karunaratne wrote:
>>
>>> Hello everyone,
>>>
>>> Can someone tell me what classes and methods are involved in the
>>> interpretation of ImageJ Macros?
>>>
>>> i.e. What method decodes lines such as run("smoothen") and calls the
>>> corresponding function related to the parameter in quotes?
>>>
>>> Thanks
>>> Pasan.
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

Re: ImageJ Macro Interpreter

Pasan Karunaratne
@Wayne

Many thanks again. :-) This was the code I was looking for.


On Thu, Jun 21, 2012 at 6:45 PM, Rasband, Wayne (NIH/NIMH) [E] <
[hidden email]> wrote:

> On Jun 21, 2012, at 5:43 AM, Pasan Karunaratne wrote:
>
> > @Wayne, Michael
> >
> > Loads of thanks for your replies. Got the code to work. :-)
> >
> > I'm facing a different problem now.
> >
> > In the binary version of ImageJ (i.e. not built from source), the macro
> > recorder displays recorded macros as
> >
> > *makeRectangle(27, 76, 137, 60);*
> > *run("Smooth");*
> >
> > However, in the git cloned version
> > (git://github.com/imagej/imagej.gitmaster branch) of
> > ImageJ, the output of the macro recorder is quite different. I can get
> > extremely complex and granular recordings, but none that simply call the
> > required function.
> >
> > For example the output for running "Smooth" is
> >
> >
> > *ModuleExecutedEvent*
> > *  >> Module: imagej.core.plugins.convolve.SharpenDataValues*
> > *    imageDisplayService =
> > imagej.data.display.DefaultImageDisplayService@115126e{ImageDisplayService}
> > *
> > *    overlayService =
> > imagej.data.display.DefaultOverlayService@10c6cfc {OverlayService}
> > *
> > *    display = imagej.data.display.DefaultImageDisplay@21b42f{ImageDisplay}
> > *
> > *ModulePostprocessEvent*
> > *ModulePostprocessEvent*
> > *ModuleFinishedEvent*
> >
> > *
> > *
> > I am looking into the SwingScriptRecorder class. Is there any other
> class I
> > should be checking out?
> >
> > Further, the cloned version seems to be quite buggy. Am I using the
> correct
> > repository?
>
> You are using the ImageJ2 Git repository (https://github.com/imagej/).
> The ImageJ repository is at
>
>    http://fiji.sc/imagej.git
>
> -wayne
>
>
> > Do you know how I can get the short and sweet output of the binary
> version
> > in the macro recorder?
> >
> >
> >
> > On Thu, Jun 21, 2012 at 2:11 PM, Michael Schmid <[hidden email]
> >wrote:
> >
> >> Hi Pasan,
> >>
> >> the macro 'run' commands are the equivalent to 'ij.IJ.run' in Java.
> >> IJ.run calls the plugin associated to the menu command; type Ctrl-L and
> >> select "Show full information" to see what the plugin is exactly named.
> >> (note that most internal ImageJ commands also use plugins, just like the
> >> plugins that you can write yourself, but these plugins are intrinsic,
> i.e.
> >> contained in the ij.jar file).
> >>
> >> E.g., IJ.run("Smooth") calls ij.plugin.filter.Filters("smooth"). The
> >> argument "smooth" is passed to the plugin in its setup method as the
> 'arg'
> >> String, to tell it which operation to perform. Many Plugins don't need
> an
> >> 'arg'; they do only one function.
> >>
> >> The java code for most other macro commands (those without 'run'; except
> >> for the macro language elements such as for loops, variable assignment,
> >> etc.) is in ij.macro.Functions.
> >>
> >> Michael
> >> ________________________________________________________________
> >> On Jun 20, 2012, at 11:09, Pasan Karunaratne wrote:
> >>
> >>> Hello everyone,
> >>>
> >>> Can someone tell me what classes and methods are involved in the
> >>> interpretation of ImageJ Macros?
> >>>
> >>> i.e. What method decodes lines such as run("smoothen") and calls the
> >>> corresponding function related to the parameter in quotes?
> >>>
> >>> Thanks
> >>> Pasan.
> >>>
> >>> --
> >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >>
> >> --
> >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >>
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: ImageJ Macro Interpreter

ctrueden
Hi Pasan,

> Many thanks again. :-) This was the code I was looking for.

Note that ImageJ 1.x is also available on GitHub, as a Maven project:

    https://github.com/fiji/imageja

Regards,
Curtis


On Thu, Jun 21, 2012 at 10:26 AM, Pasan Karunaratne <
[hidden email]> wrote:

> @Wayne
>
> Many thanks again. :-) This was the code I was looking for.
>
>
> On Thu, Jun 21, 2012 at 6:45 PM, Rasband, Wayne (NIH/NIMH) [E] <
> [hidden email]> wrote:
>
> > On Jun 21, 2012, at 5:43 AM, Pasan Karunaratne wrote:
> >
> > > @Wayne, Michael
> > >
> > > Loads of thanks for your replies. Got the code to work. :-)
> > >
> > > I'm facing a different problem now.
> > >
> > > In the binary version of ImageJ (i.e. not built from source), the macro
> > > recorder displays recorded macros as
> > >
> > > *makeRectangle(27, 76, 137, 60);*
> > > *run("Smooth");*
> > >
> > > However, in the git cloned version
> > > (git://github.com/imagej/imagej.gitmaster branch) of
> > > ImageJ, the output of the macro recorder is quite different. I can get
> > > extremely complex and granular recordings, but none that simply call
> the
> > > required function.
> > >
> > > For example the output for running "Smooth" is
> > >
> > >
> > > *ModuleExecutedEvent*
> > > *  >> Module: imagej.core.plugins.convolve.SharpenDataValues*
> > > *    imageDisplayService =
> > > imagej.data.display.DefaultImageDisplayService@115126e
> {ImageDisplayService}
> > > *
> > > *    overlayService =
> > > imagej.data.display.DefaultOverlayService@10c6cfc {OverlayService}
> > > *
> > > *    display = imagej.data.display.DefaultImageDisplay@21b42f
> {ImageDisplay}
> > > *
> > > *ModulePostprocessEvent*
> > > *ModulePostprocessEvent*
> > > *ModuleFinishedEvent*
> > >
> > > *
> > > *
> > > I am looking into the SwingScriptRecorder class. Is there any other
> > class I
> > > should be checking out?
> > >
> > > Further, the cloned version seems to be quite buggy. Am I using the
> > correct
> > > repository?
> >
> > You are using the ImageJ2 Git repository (https://github.com/imagej/).
> > The ImageJ repository is at
> >
> >    http://fiji.sc/imagej.git
> >
> > -wayne
> >
> >
> > > Do you know how I can get the short and sweet output of the binary
> > version
> > > in the macro recorder?
> > >
> > >
> > >
> > > On Thu, Jun 21, 2012 at 2:11 PM, Michael Schmid <
> [hidden email]
> > >wrote:
> > >
> > >> Hi Pasan,
> > >>
> > >> the macro 'run' commands are the equivalent to 'ij.IJ.run' in Java.
> > >> IJ.run calls the plugin associated to the menu command; type Ctrl-L
> and
> > >> select "Show full information" to see what the plugin is exactly
> named.
> > >> (note that most internal ImageJ commands also use plugins, just like
> the
> > >> plugins that you can write yourself, but these plugins are intrinsic,
> > i.e.
> > >> contained in the ij.jar file).
> > >>
> > >> E.g., IJ.run("Smooth") calls ij.plugin.filter.Filters("smooth"). The
> > >> argument "smooth" is passed to the plugin in its setup method as the
> > 'arg'
> > >> String, to tell it which operation to perform. Many Plugins don't need
> > an
> > >> 'arg'; they do only one function.
> > >>
> > >> The java code for most other macro commands (those without 'run';
> except
> > >> for the macro language elements such as for loops, variable
> assignment,
> > >> etc.) is in ij.macro.Functions.
> > >>
> > >> Michael
> > >> ________________________________________________________________
> > >> On Jun 20, 2012, at 11:09, Pasan Karunaratne wrote:
> > >>
> > >>> Hello everyone,
> > >>>
> > >>> Can someone tell me what classes and methods are involved in the
> > >>> interpretation of ImageJ Macros?
> > >>>
> > >>> i.e. What method decodes lines such as run("smoothen") and calls the
> > >>> corresponding function related to the parameter in quotes?
> > >>>
> > >>> Thanks
> > >>> Pasan.
> > >>>
> > >>> --
> > >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >>
> > >> --
> > >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >>
> > >
> > > --
> > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: ImageJ Macro Interpreter

dscho
Hi,

On Fri, 22 Jun 2012, Curtis Rueden wrote:

> > Many thanks again. :-) This was the code I was looking for.
>
> Note that ImageJ 1.x is also available on GitHub, as a Maven project:
>
>     https://github.com/fiji/imageja

BTW the corresponding Maven repository is here:

        http://maven.imagej.net/content/repositories/releases/net/imagej/ij/

And maybe I can help to clarify a little bit of confusion preemptively.
(If you are not interested in the details of software development around
ImageJ, you can safely skip the rest of this mail.)

There are basically three ImageJ-related Git repositories (in
chronological order):

1) ImageJA: this project started out as an attempt to make contributing
   easier by providing a CVS repository tracking Wayne's releases. In the
   meantime, all the ImageJA-only changes have been merged into ImageJ 1.*
   or reverted.

   ImageJA now contains 4 branches: 'imagej' which tracks Wayne's releases
   as-are, 'master' which provides a Mavenized version of 'imagej' (this
   makes a tremendous difference with developers, if you want to know why,
   please bug me again), 'current' which screen-scrapes the browsable
   source on http://imagej.net/ (as it is updated more often than there
   are official releases) and 'ijplugins' which screen-scrapes the plugins
   on http://imagej.net/ (read: it does not really contain ImageJ 1.*'s
   source code but the source code and binaries of plugins)

   ImageJA is hosted on http://fiji.sc/ImageJA.git and is mirrored to
   http://github.com/fiji/ImageJA and http://repo.or.cz/w/imageja.git for
   convenience.

2) Wayne's own Git repository: http://fiji.sc/imagej.git which is similar,
   but not quite identical, to ImageJA's 'current' branch.

3) ImageJ2: This uses the 'master' branch of ImageJA to include ImageJ 1.*
   for backwards-compatibility.

   This repository is hosted at http://github.com/imagej/imagej, mirrored
   to http://fiji.sc/imagej2/.git

I will try to find some time next week to write a blog post about the
relationship between ImageJA, ImageJ2, ImgLib2, and Fiji, and Git, GitHub,
Maven and Jenkins next week, since a couple of people expressed interest
in those details.

Ciao,
Johannes

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

Re: ImageJ Macro Interpreter

Leonardo Guizzetti
Thank you for the concise summary Johannes, I look forward to the blog
post. I'm not very family with Maven so it should be helpful to read.
Lenny


On Fri, Jun 22, 2012 at 1:37 PM, Johannes Schindelin <
[hidden email]> wrote:

> Hi,
>
> On Fri, 22 Jun 2012, Curtis Rueden wrote:
>
> > > Many thanks again. :-) This was the code I was looking for.
> >
> > Note that ImageJ 1.x is also available on GitHub, as a Maven project:
> >
> >     https://github.com/fiji/imageja
>
> BTW the corresponding Maven repository is here:
>
>
> http://maven.imagej.net/content/repositories/releases/net/imagej/ij/
>
> And maybe I can help to clarify a little bit of confusion preemptively.
> (If you are not interested in the details of software development around
> ImageJ, you can safely skip the rest of this mail.)
>
> There are basically three ImageJ-related Git repositories (in
> chronological order):
>
> 1) ImageJA: this project started out as an attempt to make contributing
>   easier by providing a CVS repository tracking Wayne's releases. In the
>   meantime, all the ImageJA-only changes have been merged into ImageJ 1.*
>   or reverted.
>
>   ImageJA now contains 4 branches: 'imagej' which tracks Wayne's releases
>   as-are, 'master' which provides a Mavenized version of 'imagej' (this
>   makes a tremendous difference with developers, if you want to know why,
>   please bug me again), 'current' which screen-scrapes the browsable
>   source on http://imagej.net/ (as it is updated more often than there
>   are official releases) and 'ijplugins' which screen-scrapes the plugins
>   on http://imagej.net/ (read: it does not really contain ImageJ 1.*'s
>   source code but the source code and binaries of plugins)
>
>   ImageJA is hosted on http://fiji.sc/ImageJA.git and is mirrored to
>   http://github.com/fiji/ImageJA and http://repo.or.cz/w/imageja.git for
>   convenience.
>
> 2) Wayne's own Git repository: http://fiji.sc/imagej.git which is similar,
>   but not quite identical, to ImageJA's 'current' branch.
>
> 3) ImageJ2: This uses the 'master' branch of ImageJA to include ImageJ 1.*
>   for backwards-compatibility.
>
>   This repository is hosted at http://github.com/imagej/imagej, mirrored
>   to http://fiji.sc/imagej2/.git
>
> I will try to find some time next week to write a blog post about the
> relationship between ImageJA, ImageJ2, ImgLib2, and Fiji, and Git, GitHub,
> Maven and Jenkins next week, since a couple of people expressed interest
> in those details.
>
> Ciao,
> Johannes
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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