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; }
public boolean reconstructDataset() { view_modes[0] = "3D color"; view_modes[1] = "2D histogram"; view_modes[2] = "2D particle intensity (16-bit)"; view_modes[3] = "2D particle intensity (8-bit)"; GenericDialog gd = new GenericDialog("Reconstruct PALM/STORM Dataset"); gd.addNumericField( "Target pixel size for the rendered image (nm)", prefs.get("QuickPALM.viewer_tpixelsize", 30), 2); gd.addNumericField("Original image width (px)", prefs.get("QuickPALM.viewer_owidth", 512), 2); gd.addNumericField("Original image height (px)", prefs.get("QuickPALM.viewer_oheight", 512), 2); gd.addChoice("View mode", view_modes, prefs.get("QuickPALM.view_mode", view_modes[1])); // gd.addNumericField("Allow image saturation (%)", prefs.get("QuickPALM.saturation", 50), 0); gd.addCheckbox( "Simulate sub-difraction spot (gaussian convolution - only 2D)", prefs.get("QuickPALM.viewer_doConvolve", true)); // gd.addCheckbox("Make 3D stack", prefs.get("QuickPALM.viewer_do3d", false)); // gd.addCheckbox("Make movie", prefs.get("QuickPALM.viewer_doMovie", false)); gd.addCheckbox("Make 3D stack", false); gd.addCheckbox("Make movie", false); // gd.addCheckbox("Save only and don't show", prefs.get("QuickPALM.viewer_doSave", false)); gd.addMessage("\n"); // ----------------------------------------- gd.addMessage("-- Simulate sub-difraction spot settings (used only if selected) --"); gd.addNumericField("FWHM of the spot", prefs.get("QuickPALM.viewer_fwhm", 30), 2); gd.addMessage("\n"); // ----------------------------------------- gd.addMessage("-- Make 3D stack settings (used only if selected) --"); gd.addNumericField("Z-spacing between slices (nm)", prefs.get("QuickPALM.viewer_zstep", 50), 2); gd.addNumericField( "Merge particle Z-position above (nm - 0 for full Z range)", prefs.get("QuickPALM.viewer_mergeabove", 0), 2); gd.addNumericField( "Merge particle Z-position bellow (nm - 0 for full Z range)", prefs.get("QuickPALM.viewer_mergebellow", 0), 2); gd.addMessage("\n"); // ----------------------------------------- gd.addMessage("-- Make movie settings (used only if selected) --"); gd.addNumericField( "Make a reconstruction in every N frames", prefs.get("QuickPALM.viewer_update", 10), 0); gd.addNumericField( "Accumulate N neighboring frames for each reconstruction\n(set to 0 to accumulate all the preceding frames)", prefs.get("QuickPALM.viewer_accumulate", 100), 0); gd.showDialog(); if (gd.wasCanceled()) return false; viewer_tpixelsize = gd.getNextNumber(); prefs.set("QuickPALM.viewer_tpixelsize", viewer_tpixelsize); viewer_owidth = (int) gd.getNextNumber(); prefs.set("QuickPALM.viewer_owidth", viewer_owidth); viewer_oheight = (int) gd.getNextNumber(); prefs.set("QuickPALM.viewer_oheight", viewer_oheight); view_mode = gd.getNextChoice(); prefs.set("QuickPALM.view_mode", view_mode); viewer_doConvolve = gd.getNextBoolean(); prefs.set("QuickPALM.viewer_doConvolve", viewer_doConvolve); viewer_do3d = gd.getNextBoolean(); prefs.set("QuickPALM.viewer_do3d", viewer_do3d); viewer_doMovie = gd.getNextBoolean(); prefs.set("QuickPALM.viewer_doMovie", viewer_doMovie); // viewer_doSave = gd.getNextBoolean(); // prefs.set("QuickPALM.viewer_doSave", viewer_doSave); // -- Simulate sub-difraction spot viewer_fwhm = gd.getNextNumber(); prefs.set("QuickPALM.viewer_fwhm", viewer_fwhm); // -- Show B&W // viewer_is8bit = gd.getNextBoolean(); // prefs.set("QuickPALM.viewer_is8bit", viewer_is8bit); // -- Make 3D stack viewer_zstep = gd.getNextNumber(); prefs.set("QuickPALM.viewer_zstep", viewer_zstep); viewer_mergeabove = gd.getNextNumber(); prefs.set("QuickPALM.viewer_mergeabove", viewer_mergeabove); viewer_mergebellow = gd.getNextNumber(); prefs.set("QuickPALM.viewer_mergebellow", viewer_mergebellow); // -- Make Movie viewer_update = (int) gd.getNextNumber(); prefs.set("QuickPALM.viewer_update", viewer_update); viewer_accumulate = (int) gd.getNextNumber(); prefs.set("QuickPALM.viewer_accumulate", viewer_accumulate); return true; }