title: ImageJ API WaitForUserDialog
body: <p>I'm trying to write a plugin for ImageJ that will prompt a user to select a rectangular ROI in a region in the image using the rectangular selection tool button built into the menu bar. Here is my code:</p>
  
  <pre><code>import ij.*;
  import ij.process.*;
  import ij.gui.*;
  import java.awt.*;
  import ij.plugin.*;
  
  public class computeDOP implements PlugIn {
  
  public void run(String arg) {
      IJ.showMessage("DOP Plugin Status","Load Image");       
      ImagePlus imp = IJ.openImage();
      imp.show();
      IJ.showMessage("DOP Plugin Status","Phantom Loaded, Select Rectangle ROI");     
  
      //Image ROI
      WaitForUserDialog wait = new WaitForUserDialog("Select a Rectangular ROI", "Please press OK when done.");
      wait.show();
      Roi userROI = impPhantom.getRoi();
  
      //Create a profile plot
      ProfilePlot pPlotPhantom = new ProfilePlot(impPhantom, true);
      double[] phanProfile = pPlotPhantom.getProfile();
  
  
  
  }
  </code></pre>
  
  <p>My problem is that the focus shifts to the prompt dialog that appears due to the WaitForUserDialog. Then it won't allow the user to use any of the menu tools built in to ImageJ. My goal is to halt the plugin, and wait for the user to click ok on the dialog box that appears. However, I need my user to be able to use the rectangle selection tool. Should I be looking into some other way to halt my plugin and prompt the user to select an ROI?</p>