Pradeep R
Pradeep R

Reputation: 21

Incorporating a plugin into an ImageJ/FIJI Macro (bUnwarpJ)

I am trying to integrate the plugin, bUnwarpJ into an ImageJ macro I have been writing. The aim is to call this plugin, allow the user to define the parameters and run it. This plugin has an option to save the user defined parameters, i.e., "save landmarks". I would like this to be executed as well by calling: call("bunwarpj.bUnwarpJ_.saveLandmarks", output folder) from within my plugin.

Currently, the code is:

run("bUnwarpJ");
call("bunwarpj.bUnwarpJ_.saveLandmarks", output folder);

The problem is once bUnwarpJ is completed, you cannot call 'save landmarks' method, and will lose the user input data as well. How would you solve this?

One idea was to have a pop up window (before the run command) which will NOT pause the user interaction, and when the user completes defining landmarks, they can then click OK on this window which executes call(), thereby saving the landmarks while bUnwarpJ is running. The problem I had was most of popup windows will pause the rest of the code..It would ideally be like:

#command for popup window here
run("bUnwarpJ"); #when user is finished, they click Ok on the box above

#which executes: call("bunwarpj.bUnwarpJ_.saveLandmarks", output folder);

Any help is appreciated. Thanks!

Upvotes: 2

Views: 337

Answers (2)

J. Kovacs
J. Kovacs

Reputation: 177

Using the initial dialog box would definitely be the simplest method to get the input parameters. If for some reason this doesn't work, you might consider putting in a line like:

run("bUnwarpJ");
waitForUser("Input Your Parameters");

I haven't used UnwarpJ, but the waitForUser command should allow the macro to pause for the manual input if the user is meant to do steps other than just parameter inputs. Otherwise, ejkiely's suggestion will be the fastest solution.

Upvotes: 0

ekiely
ekiely

Reputation: 102

Is the user defining landmarks by creating an ROI or something else that might require them to actually interact with an image? If not, and/or those landmark values can be generated ahead of time (using a single image as a template for your batch), you might consider just adding a user interface/dialog box that requests the landmark values and then saves them as a set of variables, or an array. Let me know if that sounds like it might be on the right track and I can do my best to help you set that up.

Upvotes: 1

Related Questions