Example #1
0
  public void run(String arg) {
    ImagePlus imp = WindowManager.getCurrentImage();
    if (imp == null) {
      IJ.noImage();
      return;
    }

    ImageStack stack1 = imp.getStack();
    String fileName = imp.getTitle();
    int endslice = stack1.getSize();

    ImagePlus imp2 = duplicateStack(imp);
    imp2.show();
    String duplicateName = imp2.getTitle();
    // IJ.showMessage("Box",fileName);
    ImageStack stack2 = imp2.getStack();
    stack1.deleteSlice(1);
    stack2.deleteSlice(endslice);

    String calculatorstring =
        ("image1='"
            + fileName
            + "' operation=Subtract image2="
            + imp2.getTitle()
            + " create stack");

    IJ.run("Image Calculator...", calculatorstring);
    ImagePlus imp3 = WindowManager.getCurrentImage();
    imp3.setTitle(fileName + " DeltaF up");
    imp2.getWindow().close();
    imp.getWindow().close();
  }
 /**
  * Execute plugin functionality: stack FFT with window function, max projection over all slices
  * (phase, Z angle), blank out central 1/8 circle (set to min value), display min-max.
  */
 public ResultSet exec(ImagePlus... imps) {
   ImagePlus imp = imps[0];
   Util_StackFFT2D stackFFT2D = new Util_StackFFT2D();
   stackFFT2D.resultTypeChoice = Util_StackFFT2D.resultType[1];
   ImagePlus impF = stackFFT2D.exec(imp);
   IJ.run(impF, "Z Project...", "projection=[Max Intensity]");
   ImagePlus impProjF = ij.WindowManager.getCurrentImage();
   maskCentralRegion(impProjF);
   if (impProjF.isComposite()) {
     // display grayscale, not colored composite
     CompositeImage ci = (CompositeImage) impProjF;
     ci.setMode(IJ.GRAYSCALE);
     impProjF.updateAndDraw();
   }
   displayMinToMax(impProjF);
   impProjF.setTitle(I1l.makeTitle(imps[0], TLA));
   String shortInfo =
       "Maximum intensity projection of log"
           + " (amplitude^2) 2D FFT stack, central region masked,"
           + " rescaled (min-max) to improve contrast of the relevant"
           + " frequency range.";
   results.addImp(shortInfo, impProjF);
   results.addInfo(
       "How to interpret",
       "look for clean 1st & 2nd"
           + " order spots, similar across angles. Note that spot"
           + " intensity depends on image content.");
   return results;
 }