예제 #1
0
  private static final int[] GetIntArrayTagValue(
      final org.w3c.dom.Element eTag, final java.lang.String strTag) {
    if (null == eTag || null == strTag || null == eTag.getElementsByTagName(strTag)) return null;

    org.w3c.dom.NodeList nl = eTag.getElementsByTagName(strTag);

    if (!(nl.item(0) instanceof org.w3c.dom.Element)) return null;

    org.w3c.dom.Element elem = (org.w3c.dom.Element) nl.item(0);

    if (null == elem
        || null == elem.getChildNodes()
        || null == elem.getChildNodes().item(0)
        || !(elem.getChildNodes().item(0) instanceof org.w3c.dom.Node)) return null;

    java.lang.String strValue = elem.getChildNodes().item(0).getNodeValue();

    if (null == strValue || strValue.isEmpty()) return null;

    java.lang.String[] astrValue = strValue.split(",");

    int[] ai = new int[astrValue.length];

    for (int i = 0; i < astrValue.length; ++i)
      ai[i] = new java.lang.Integer(astrValue[i]).intValue();

    return ai;
  }
 protected void jparseargs(
     java.lang.String jlocale, java.lang.String jchildid, java.lang.String joverride) {
   this.jlocale = jlocale;
   this.jchildid = jchildid;
   if (jchildid != null && jchildid.length() > 0) jchildidx = jchildid + "_";
   else jchildidx = "";
   if (joverride != null && joverride.length() > 0) {
     java.lang.String[] ss = joverride.split(" ");
     for (int i = 0; i < ss.length; i++) setjnOverride(ss[i]);
   }
 }
예제 #3
0
파일: MyIO.java 프로젝트: baowuji/quickpalm
  public void run() {
    line.trim();
    elements = line.split("\t");
    if (elements.length < 14) return;

    lock.lock();
    res.incrementCounter();
    res.addValue("Intensity", Double.parseDouble(elements[1]));
    res.addValue("X (px)", Double.parseDouble(elements[2]));
    res.addValue("Y (px)", Double.parseDouble(elements[3]));
    res.addValue("X (nm)", Double.parseDouble(elements[4]));
    res.addValue("Y (nm)", Double.parseDouble(elements[5]));
    res.addValue("Z (nm)", Double.parseDouble(elements[6]));
    res.addValue("Left-StdDev (px)", Double.parseDouble(elements[7]));
    res.addValue("Right-StdDev (px)", Double.parseDouble(elements[8]));
    res.addValue("Up-StdDev (px)", Double.parseDouble(elements[9]));
    res.addValue("Down-StdDev (px)", Double.parseDouble(elements[10]));
    res.addValue("X Symmetry (%)", Double.parseDouble(elements[11]));
    res.addValue("Y Symmetry (%)", Double.parseDouble(elements[12]));
    res.addValue("Width minus Height (px)", Double.parseDouble(elements[13]));
    res.addValue("Frame Number", Double.parseDouble(elements[14]));
    lock.unlock();
  }
예제 #4
0
  public boolean analyseParticles(MyFunctions f) {
    GenericDialog gd = new GenericDialog("Analyse PALM/STORM Particles");
    gd.addNumericField("Minimum SNR", prefs.get("QuickPALM.snr", 5), 2);
    gd.addNumericField("Maximum FWHM (in px)", prefs.get("QuickPALM.fwhm", 4), 0);
    gd.addNumericField("Image plane pixel size (nm)", prefs.get("QuickPALM.pixelsize", 106), 2);
    gd.addCheckbox("Smart SNR", prefs.get("QuickPALM.smartsnr", true));
    gd.addCheckbox(
        "3D PALM (astigmatism) - will require calibration file",
        prefs.get("QuickPALM.is3d", false));
    gd.addCheckbox("Online rendering", prefs.get("QuickPALM.view", true));
    gd.addCheckbox("Attach to running acquisition", prefs.get("QuickPALM.attach", false));
    gd.addCheckbox("Stream particle info directly into file", prefs.get("QuickPALM.stream", true));
    gd.addMessage("\n");
    // -----------------------------------------
    gd.addMessage("-- Online rendering settings (used only if selected) --");
    gd.addMessage("\n");
    gd.addNumericField("Pixel size of rendered image (nm)", 30, 2);
    gd.addNumericField("Accumulate last (0 to accumulate all frames)", 0, 0);
    gd.addNumericField("Update every (frames)", 10, 0);
    // gd.addNumericField("Allow color saturation (%)", 50, 0);
    gd.addMessage("\n");
    // -----------------------------------------
    gd.addMessage("-- Attach to running acquisition settings (used only if selected) --");
    gd.addMessage("\n");
    gd.addStringField(
        "_Image name pattern (NN...NN represents the numerical change)",
        prefs.get("QuickPALM.pattern", "imgNNNNNNNNN.tif"),
        20);
    gd.addNumericField("Start NN...NN with", 0, 0);
    gd.addNumericField("In acquisition max. wait time for new image (ms)", 50, 0);
    gd.addMessage("\n");
    // -----------------------------------------
    gd.addMessage("-- Advanced settings (don't normally need to be changed) --");
    gd.addMessage("\n");
    gd.addNumericField("_Minimum symmetry (%)", prefs.get("QuickPALM.symmetry", 50), 0);
    gd.addNumericField(
        "Local threshold (% maximum intensity)", prefs.get("QuickPALM.lthreshold", 20), 0);
    gd.addNumericField("_Maximum iterations per frame", prefs.get("QuickPALM.maxiter", 1000), 0);
    gd.addNumericField(
        "Threads (each takes ~3*[frame size] in memory)", prefs.get("QuickPALM.nthreads", 50), 0);
    gd.addMessage("\n\nDon't forget to save the table in the end...");

    gd.showDialog();
    if (gd.wasCanceled()) return false;

    snr = (int) gd.getNextNumber();
    prefs.set("QuickPALM.snr", snr);
    fwhm = gd.getNextNumber();
    prefs.set("QuickPALM.fwhm", fwhm);
    pixelsize = gd.getNextNumber();
    prefs.set("QuickPALM.pixelsize", pixelsize);

    smartsnr = gd.getNextBoolean();
    prefs.set("QuickPALM.smartsnr", smartsnr);
    is3d = gd.getNextBoolean();
    prefs.set("QuickPALM.is3d", is3d);
    view = gd.getNextBoolean();
    prefs.set("QuickPALM.view", view);
    attach = gd.getNextBoolean();
    prefs.set("QuickPALM.attach", attach);

    if (gd.getNextBoolean()) {
      f.psave = new ParticleSaver();
      f.psave.setup();
      prefs.set("QuickPALM.stream", true);
    } else prefs.set("QuickPALM.stream", false);
    // --

    magn = pixelsize / gd.getNextNumber();
    viewer_accumulate = (int) gd.getNextNumber();
    viewer_update = (int) gd.getNextNumber();

    // --
    pattern = gd.getNextString().trim();
    prefs.set("QuickPALM.pattern", pattern);
    prefix = pattern.substring(0, pattern.indexOf("N"));
    sufix = pattern.substring(pattern.lastIndexOf("N") + 1, pattern.length());
    nimchars = pattern.split("N").length - 1;
    nimstart = (int) gd.getNextNumber();
    waittime = (int) gd.getNextNumber();

    // --

    symmetry = gd.getNextNumber() / 100;
    prefs.set("QuickPALM.symmetry", symmetry);
    pthrsh = gd.getNextNumber() / 100;
    prefs.set("QuickPALM.lthreshold", pthrsh * 100);
    maxpart = (int) gd.getNextNumber();
    prefs.set("QuickPALM.maxiter", maxpart);
    threads = (int) gd.getNextNumber();
    prefs.set("QuickPALM.nthreads", threads);

    return true;
  }