ImageJ macro to Java conversion

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

ImageJ macro to Java conversion

Avital Steinberg
Hi,
I would like to convert code from the ImageJ macro language to Java. What
is the best way to do that?

Thank you,
Avital

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

Re: ImageJ macro to Java conversion

Paul van Schayck
Dear Avital,

I'm not sure there is a best way for that. Making yourself familiar with
the API is a start:
http://rsbweb.nih.gov/ij/developer/api/overview-summary.html

Kind regards,

Paul


On Wed, Jul 30, 2014 at 10:39 AM, Avital Steinberg <
[hidden email]> wrote:

> Hi,
> I would like to convert code from the ImageJ macro language to Java. What
> is the best way to do that?
>
> Thank you,
> Avital
>
> --
> 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 to Java conversion

CARL Philippe (LBP)
In reply to this post by Avital Steinberg
Dear Avital,
I think, but I may of course be wrong, that before trying to answer your
question you should first explain us why you would like to convert a macro
into a plugin.
Indeed, You may want to develop a plugin in the case the job you want to
perform is too sharp for being done with a macro.
A plugin is giving you more power and within them the possibility to even
overwrite (within your plugin) native ImageJ classes.
Nevertheless plugins are in the same time more difficult and time consuming
to develop than a macro where most of the code can simply be generated
automatically by using the macro recorder.
My best regards,
Philippe

Philippe CARL
Laboratoire de Biophotonique et Pharmacologie
UMR 7213 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 41 84


-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de Avital
Steinberg
Envoyé : mercredi 30 juillet 2014 10:39
À : [hidden email]
Objet : ImageJ macro to Java conversion

Hi,
I would like to convert code from the ImageJ macro language to Java. What is
the best way to do that?

Thank you,
Avital

--
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 to Java conversion

Jan Eglinger
In reply to this post by Avital Steinberg
Dear Avital and Philippe,

On 30.07.2014, 11:48 AM, Philippe CARL wrote:
> Nevertheless plugins are in the same time more difficult and time consuming
> to develop than a macro where most of the code can simply be generated
> automatically by using the macro recorder.

The macro recorder can indeed be used to record Java code for plugins
[1]. If you use Fiji, you can even combine the easy prototyping of
scripts with the full accessibility of the Java API, e.g. by using
Beanshell, Jython or Javascript scripting [2].

I would suggest that you re-record the steps from the macro with the
recorder set to Java (or Javascript or Beanshell).

Cheers,
Jan

[1]:
http://imagej.nih.gov/ij/docs/guide/146-31.html#sub:Record...
[2]:
http://fiji.sc/Scripting_Help


> -----Message d'origine-----
> De : ImageJ Interest Group [mailto:[hidden email]] De la part de Avital
> Steinberg
> Envoyé : mercredi 30 juillet 2014 10:39
> À : [hidden email]
> Objet : ImageJ macro to Java conversion
>
> Hi,
> I would like to convert code from the ImageJ macro language to Java. What is
> the best way to do that?
>
> Thank you,
> Avital
>

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

Re: ImageJ macro to Java conversion

Avital Steinberg
In reply to this post by Avital Steinberg
Dear Philippe,
We made the macro by using the macro recorder, but now we'd like it to be
written properly so that other people will have an easier time using it and
understanding our code.

Thank you,
Avital


On Wed, Jul 30, 2014 at 12:48 PM, Philippe CARL <[hidden email]>
wrote:

> Dear Avital,
> I think, but I may of course be wrong, that before trying to answer your
> question you should first explain us why you would like to convert a macro
> into a plugin.
> Indeed, You may want to develop a plugin in the case the job you want to
> perform is too sharp for being done with a macro.
> A plugin is giving you more power and within them the possibility to even
> overwrite (within your plugin) native ImageJ classes.
> Nevertheless plugins are in the same time more difficult and time consuming
> to develop than a macro where most of the code can simply be generated
> automatically by using the macro recorder.
> My best regards,
> Philippe
>
> Philippe CARL
> Laboratoire de Biophotonique et Pharmacologie
> UMR 7213 CNRS - Université de Strasbourg
> Faculté de Pharmacie
> 74 route du Rhin
> 67401 ILLKIRCH
> Tel : +33(0)3 68 85 41 84
>
>
> -----Message d'origine-----
> De : ImageJ Interest Group [mailto:[hidden email]] De la part de
> Avital
> Steinberg
> Envoyé : mercredi 30 juillet 2014 10:39
> À : [hidden email]
> Objet : ImageJ macro to Java conversion
>
> Hi,
> I would like to convert code from the ImageJ macro language to Java. What
> is
> the best way to do that?
>
> Thank you,
> Avital
>
> --
> 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 to Java conversion

Avital Steinberg
In reply to this post by Paul van Schayck
Dear Paul,
Thank you for the useful link,

Avital


On Wed, Jul 30, 2014 at 12:35 PM, Paul van Schayck <[hidden email]>
wrote:

> Dear Avital,
>
> I'm not sure there is a best way for that. Making yourself familiar with
> the API is a start:
> http://rsbweb.nih.gov/ij/developer/api/overview-summary.html
>
> Kind regards,
>
> Paul
>
>
> On Wed, Jul 30, 2014 at 10:39 AM, Avital Steinberg <
> [hidden email]> wrote:
>
> > Hi,
> > I would like to convert code from the ImageJ macro language to Java. What
> > is the best way to do that?
> >
> > Thank you,
> > Avital
> >
> > --
> > 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 to Java conversion

CARL Philippe (LBP)
In reply to this post by Avital Steinberg
Dear Avital,
The answer of Jan about "re-recording the steps from the macro with the
recorder set to Java" is actually the solution of the question you asked and
given that I wasn't aware of this option (which is quite cool to know) I'm
very happy you asked your question on the list.
Nevertheless, if what you are looking for is to "write properly your code so
that other people will have an easier time using it and understanding it"
you don't need to move your code to a plugin, but can just stick with the
macro language.
The macro recorder will never generate you a "final code" as you may wish
it, but just give you the framework of a good begin.
And from this framework it is then up to you to add comments in your macro,
add functions (with adapted names for example: "function
calculateLinePointDistance(xValuesLine, yValuesLine, xPoint, yPoint)") to
make it easier and more compact to read, use parameters with adapted names
(i.e. not "a, b, c,..." but rather "pictureName, pictureWidth,
pictureHeight,...").
My best regards,
Philippe

-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de Avital
Steinberg
Envoyé : mercredi 30 juillet 2014 12:48
À : [hidden email]
Objet : Re: ImageJ macro to Java conversion

Dear Philippe,
We made the macro by using the macro recorder, but now we'd like it to be
written properly so that other people will have an easier time using it and
understanding our code.

Thank you,
Avital

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