/*------------------------------------------------------------------*/
  public void run(String arg) {
    ImagePlus imp = WindowManager.getCurrentImage();
    this.imp = imp;
    if (imp == null) {
      IJ.noImage();
      return;
    }
    if ((1 < imp.getStackSize()) && (imp.getType() == imp.COLOR_256)) {
      IJ.error("Stack of color images not supported (use grayscale)");
      return;
    }
    if (1 < imp.getStackSize()) {
      if (imp.getStack().isRGB()) {
        IJ.error("RGB color images not supported (use grayscale)");
        return;
      }
    }
    if (1 < imp.getStackSize()) {
      if (imp.getStack().isHSB()) {
        IJ.error("HSB color images not supported (use grayscale)");
        return;
      }
    }
    if (imp.getType() == imp.COLOR_256) {
      IJ.error("Indexed color images not supported (use grayscale)");
      return;
    }
    if (imp.getType() == imp.COLOR_RGB) {
      IJ.error("Color images not supported (use grayscale)");
      return;
    }

    differentialsDialog dialog =
        new differentialsDialog(IJ.getInstance(), "Differentials", true, operation);
    GUI.center(dialog);
    dialog.setVisible(true);
    cancel = dialog.getCancel();
    operation = dialog.getOperation();
    dialog.dispose();
    if (cancel) {
      return;
    }

    imp.startTiming();
    if (1 < imp.getStackSize()) {
      if (!(imp.getProcessor().getPixels() instanceof float[])) {
        new StackConverter(imp).convertToGray32();
      }
    } else {
      if (!(imp.getProcessor().getPixels() instanceof float[])) {
        new ImageConverter(imp).convertToGray32();
      }
    }
    ImageStack stack = imp.getStack();
    stackSize = stack.getSize();
    Undo.reset();

    setupProgressBar();
    resetProgressBar();

    for (int i = 1; (i <= stackSize); i++) {
      ImageProcessor ip = stack.getProcessor(i);
      doIt(ip);
      imp.getProcessor().resetMinAndMax();
      imp.setSlice(i);
      imp.updateAndRepaintWindow();
    }
    imp.getProcessor().resetMinAndMax();
    imp.setSlice(1);
    imp.updateAndRepaintWindow();
    cleanUpProgressBar();
    IJ.showTime(imp, imp.getStartTime(), "Differentials: ");
    ImageWindow win = imp.getWindow();
    if (win != null) {
      win.running = false;
    }
  } /* end run */