Calling bUnwarpJ from a macro



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 landmarks 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:

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

The problem is once bUnwarpJ is completed, you cannot call I/O method, ‘save landmarks’ , and will lose the user input landmark data as well. How would you solve this?
It would be great to run this once the user clicks ‘ok’ on bUnwarpJ plugin.

If not, another idea I had was to have a pop up window (before executing the run command of the plugin) 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!