Re: Radial profile ext to work with Macros

Posted by Michael Schmid on
URL: http://imagej.273.s1.nabble.com/Radial-profile-ext-to-work-with-Macros-tp5005598p5005940.html

Hi Philippe,

when recording, a GenericDialog records the values (including checkbox settings, Choice menu settings) after the user has pressed the 'OK' button.
When running the macro, it fills in the values and behaves as if the user had pressed 'OK'.

So it won't record pressing any other buttons, and when running the macro it won't simulate pressing any buttons.

If this is ok for you, you can add a Panel with an arbitrary number of buttons to the GenericDialog. You have to add your class as an ActionListener for all the buttons and have an actionPerformed method that detects which button was pressed and reacts accordingly. The actionPerformed methods may modify input fields of the GenericDialog, e.g. change the numbers in the numeric fields (getText, setText).

If your plugin implements ExtendedPlugInFilter and DialogListener you may also have a 'preview' checkbox. With preview on, you could e.g. show what a selection with given center coordinates would look like on the image (set a roi or overlay in the run(ip) method).

Michael
________________________________________________________________
On Dec 18, 2013, at 15:05, Philippe CARL wrote:

> Dear all,
> Following the request of macro integration of the "Radial profile ext" plugin, I tried to move forward.
> Thus up to the following document:
> http://rsb.info.nih.gov/ij/docs/macro_reference_guide.pdf
> in order to have easily access to the built-in macro command recorder, the plugin should be using the ij.gui.GenericDialog class (I'm very happy to be aware of this now since I used already this knowledge for another project...).
> In the "Radial profile ext" plugin I haven't used this class but the GenericRecallableDialog class developped in the Contour_Plotter routine by Walter O'Dell PhD.
> And I used this class since with this class the window is non blocking (can actually be solved by using the NonBlockingGenericDialog class developed by Johannes Schindelin) but as well since it is possible to add more buttons in the window (the "Radial profile ext" plugin has 6 buttons) which seems can't be done with the NonBlockingGenericDialog class.
> Thus is there a way to use the NonBlockingGenericDialog class and implement more than 2 (= 6 in my case) buttons with it?
> Alternatively I need to stick with the GenericRecallableDialog class and thus implement calls to public static methods like described at the page 17 and 18 of the http://rsb.info.nih.gov/ij/docs/macro_reference_guide.pdf file.
> Unfortunately with the data indicated in this document I'm not able to move forward (for example where and how should the "Recorder.record" command be used?).
> Could some examples of such implementation be found somewhere for better understanding?
> I thank you very much in advance.
> 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
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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