Login  Register

Re: set default parameters in dialog Plugin and get used parameters

Posted by Rasband, Wayne (NIH/NIMH) [E] on Jun 27, 2014; 8:39pm
URL: http://imagej.273.s1.nabble.com/set-default-parameters-in-dialog-Plugin-and-get-used-parameters-tp5008470p5008477.html

On Jun 27, 2014, at 10:04 AM, Emanuele Martini wrote:

> Hi to all,
> i searched for this topic, but unfortunately I hadn't find reply.
> I'm programming in jython.
> I have two questions:
> 1) How can I setup some default parameters in the dialog box of existing
> plugin (without launch the plugin).
> Specifically, I want to setup the dialog box of Find Maxima plugin with
> noise 150 and output Single Points, and i want to define the binary
> morphologically operation using the Options plugin with iteration = 2 and
> type Dilation.

Show the dialog in the script and then call the plugin. Here is a JavaScript example that calls the MaximumFinder plugin:

  imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
  types = ["Single Points", "Maxima Within Tolerance", "Segmented Particles",
     "Point Selection", "List", "Count"];
  output = 0;
  noise = 150;
  gd = new GenericDialog("Find Maxima");
  gd.addChoice("Type:", types, output);
  gd.addNumericField("Tolerance:", noise, 0);
  gd.showDialog();
  output = gd.getNextChoiceIndex();
  noise = gd.getNextNumber();
  if (!gd.wasCanceled()) {
     mf = new MaximumFinder();
     ip = mf.findMaxima(imp.getProcessor(), noise, 0, output, false, false);
     if (ip!=null)
        new ImagePlus("Points", ip).show();
  };

-wayne

>
> 2) the second question is how can I store, after the user press ok and
> launch these plugins, the parameters actually used by the user.
>
> Thank you,
> have a nice day
> Emanuele Martini
> imaging IFOM campus
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/set-default-parameters-in-dialog-Plugin-and-get-used-parameters-tp5008470.html
> Sent from the ImageJ mailing list archive at Nabble.com.

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