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(); }
// at the very end - show output image (if the is a separate one) private void showOutput() { if (interrupted) return; if (outStack != null) { outImp = new ImagePlus(TITLE_PREFIX[processType] + imp.getShortTitle(), outStack); int[] d = imp.getDimensions(); outImp.setDimensions(d[2], d[3], d[4]); for (int i = 1; i <= imp.getStackSize(); i++) outStack.setSliceLabel(imp.getStack().getSliceLabel(i), i); } if (outImageType != BYTE_OVERWRITE) { ImageProcessor ip = outImp.getProcessor(); if (!Prefs.blackBackground) ip.invertLut(); ip.resetMinAndMax(); outImp.show(); } }