コード例 #1
0
ファイル: Delta_F_up.java プロジェクト: HelioScan/HelioScan
  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();
  }
コード例 #2
0
ファイル: MyDialogs.java プロジェクト: baowuji/quickpalm
  public boolean beadCalibration3d() {
    imp = IJ.getImage();
    if (imp == null) {
      IJ.noImage();
      return false;
    } else if (imp.getStackSize() == 1) {
      IJ.error("Stack required");
      return false;
    } else if (imp.getType() != ImagePlus.GRAY8 && imp.getType() != ImagePlus.GRAY16) {
      // In order to support 32bit images, pict[] must be changed to float[], and  getPixel(x, y);
      // requires a Float.intBitsToFloat() conversion
      IJ.error("8 or 16 bit greyscale image required");
      return false;
    }
    width = imp.getWidth();
    height = imp.getHeight();
    nslices = imp.getStackSize();
    imtitle = imp.getTitle();

    models[0] = "*None*";
    models[1] = "line";
    models[2] = "2nd degree polynomial";
    models[3] = "3rd degree polynomial";
    models[4] = "4th degree polynomial";

    GenericDialog gd = new GenericDialog("3D PALM calibration");
    gd.addNumericField("Maximum FWHM (in px)", prefs.get("QuickPALM.3Dcal_fwhm", 20), 0);
    gd.addNumericField(
        "Particle local threshold (% maximum intensity)", prefs.get("QuickPALM.pthrsh", 20), 0);
    gd.addNumericField("Z-spacing (nm)", prefs.get("QuickPALM.z-step", 10), 2);
    gd.addNumericField("Calibration Z-smoothing (radius)", prefs.get("QuickPALM.window", 1), 0);
    gd.addChoice("Model", models, prefs.get("QuickPALM.model", models[3]));
    gd.addCheckbox(
        "Show divergence of bead positions against model",
        prefs.get("QuickPALM.3Dcal_showDivergence", false));
    gd.addCheckbox("Show extra particle info", prefs.get("QuickPALM.3Dcal_showExtraInfo", false));
    gd.addMessage("\n\nDon't forget to save the table in the end...");
    gd.showDialog();
    if (gd.wasCanceled()) return false;
    fwhm = gd.getNextNumber();
    prefs.set("QuickPALM.QuickPALM.3Dcal_fwhm", fwhm);
    pthrsh = gd.getNextNumber() / 100;
    prefs.set("QuickPALM.pthrsh", pthrsh * 100);
    cal_z = gd.getNextNumber();
    prefs.set("QuickPALM.z-step", cal_z);
    window = (int) gd.getNextNumber();
    prefs.set("QuickPALM.window", window);
    model = gd.getNextChoice();
    prefs.set("QuickPALM.model", model);
    part_divergence = gd.getNextBoolean();
    prefs.set("QuickPALM.3Dcal_showDivergence", part_divergence);
    part_extrainfo = gd.getNextBoolean();
    prefs.set("QuickPALM.3Dcal_showExtraInfo", part_extrainfo);
    return true;
  }
コード例 #3
0
 public void run(String arg) {
   ImagePlus imp = WindowManager.getCurrentImage();
   if (imp == null) {
     IJ.noImage();
     return;
   }
   if (imp.getStackSize() > 1) {
     IJ.error("This command requires a montage");
     return;
   }
   GenericDialog gd = new GenericDialog("Stack Maker");
   gd.addNumericField("Images_per_row: ", w, 0);
   gd.addNumericField("Images_per_column: ", h, 0);
   gd.addNumericField("Border width: ", b, 0);
   gd.showDialog();
   if (gd.wasCanceled()) return;
   w = (int) gd.getNextNumber();
   h = (int) gd.getNextNumber();
   b = (int) gd.getNextNumber();
   ImageStack stack = makeStack(imp.getProcessor(), w, h, b);
   new ImagePlus("Stack", stack).show();
 }
コード例 #4
0
  public boolean showDialog() {

    String bgChoice = "NoBg";
    int[] wList = WindowManager.getIDList();
    if (wList == null) {
      IJ.noImage();
      return false;
    }

    String[] sampleTitles = new String[wList.length];
    for (int i = 0; i < wList.length; i++) {
      ImagePlus imp = WindowManager.getImage(wList[i]);
      sampleTitles[i] = imp != null ? imp.getTitle() : "";
    }
    String[] bgTitles = new String[wList.length + 1];
    bgTitles[0] = "NoBg";
    for (int i = 1; i < wList.length + 1; i++) {
      bgTitles[i] = sampleTitles[i - 1];
    }
    for (int i = 1; i < (wList.length + 1); i++) {
      if (bgTitles[i] == bgStackTitle) bgChoice = bgStackTitle;
    }
    String sampleChoice = sampleTitles[0];
    for (int i = 1; i < (wList.length); i++) {
      if (sampleTitles[i] == sampleStackTitle) sampleChoice = sampleStackTitle;
    }

    String[] mirrors = new String[2];
    mirrors[0] = "No";
    mirrors[1] = "Yes";

    GenericDialog gd = new GenericDialog("PolScope 5Frame Calc");
    gd.addChoice("Sample:", sampleTitles, sampleChoice);
    gd.addChoice("Background:", bgTitles, bgChoice);
    gd.addChoice("Mirror:", mirrors, mirror);
    gd.addNumericField("Wavelength: ", wavelength, 1, 8, " nm");
    gd.addNumericField("Swing: ", swing, 3, 8, " wavelength");
    gd.addNumericField("Ret. Ceiling: ", retCeiling, 1, 8, " nm");
    gd.addNumericField("Orient. Ref.: ", azimRef, 1, 8, " degree");
    gd.showDialog();
    if (gd.wasCanceled()) return false;
    int index1 = gd.getNextChoiceIndex();
    int index2 = gd.getNextChoiceIndex();
    int index3 = gd.getNextChoiceIndex();
    wavelength = (float) gd.getNextNumber();
    swing = (float) gd.getNextNumber();
    retCeiling = (float) gd.getNextNumber();
    azimRef = (float) gd.getNextNumber();

    imp1 = WindowManager.getImage(wList[index1]);
    sampleStackTitle = sampleTitles[index1];
    bgStackTitle = bgTitles[index2];
    if (bgStackTitle == "NoBg") {
      imp2 =
          WindowManager.getImage(
              wList[
                  index1]); // only to assign a valid ImagePlus to imp2 which is not used when NoBg
    } else {
      imp2 = WindowManager.getImage(wList[index2 - 1]);
    }
    mirror = mirrors[index3];

    return true;
  }