예제 #1
0
파일: Type.java 프로젝트: nypgit/alto
    /**
     * File type operator accepts <code>"path/file.(type)"<code> and
     * <code>"path/file.(type).other"</code> (as in
     * <code>"path/file.(type).xml"</code> and
     * <code>"path/file.(type).txt"</code>) conventions.
     *
     * @param path File path string
     * @return File type string
     */
    public static final java.lang.String FextI(java.lang.String path) {
      if (null == path || 1 > path.length()) return null;
      else {
        java.lang.String p = path;
        int idx = p.lastIndexOf('/');
        if (-1 < idx)
          /*
           * (trim)
           */
          p = p.substring(idx + 1);

        int i0 = p.lastIndexOf('.');
        if (-1 < i0) {
          int i1 = p.lastIndexOf('.', (i0 - 1));
          if (-1 < i1 && i1 < i0)
            /*
             * file.(type).xml
             */
            return p.substring(i1 + 1, i0);
          else
            /*
             * file.(type)
             */
            return p.substring(i0 + 1);
        } else
          /*
           * (punt)
           */
          return p;
      }
    }
예제 #2
0
  public void addExceptions(java.lang.String exceptionStr) {
    if (Configuration.getShowImport().equalsIgnoreCase("true")) {
      java.lang.String simplename = "";
      java.lang.String fullName = exceptionStr;
      int lastSlash = fullName.lastIndexOf("/");
      if (lastSlash == -1) {
        lastSlash = fullName.lastIndexOf(".");
      }
      if (lastSlash != -1) {
        simplename = fullName.substring(lastSlash + 1);
      } else simplename = fullName;
      fullName = fullName.replace('/', '.');
      ConsoleLauncher.addImportClass(fullName);
      exceptions.add(simplename);

    } else exceptions.add(exceptionStr);
  }
예제 #3
0
  public void parseDescriptor(java.lang.String descriptor) {
    if (methodName.equalsIgnoreCase("<clinit>")) {
      methodName = "static";
      descriptor = "";
      accessSpecifiers = new java.lang.String[] {""};
      return;
    }
    int charIndex = 0;
    java.lang.String parameterString = descriptor.substring(1, descriptor.lastIndexOf(")"));
    java.lang.String returnString = descriptor.substring(descriptor.lastIndexOf(")") + 1);
    if (returnString.trim().charAt(0) == 'L' || returnString.trim().charAt(0) == '[')
      this.setReturnTypeAsObjectOrArrayType(true);
    else this.setReturnTypeAsObjectOrArrayType(false);

    java.lang.String arrString = "";
    // while(charIndex < parameterString.length())
    while (parameterString.length() > 0) {
      if (parameterString.startsWith("L")) {
        java.lang.String objectString = parameterString.substring(0, parameterString.indexOf(";"));
        objectString = objectString.replace('/', '.');
        parameters.add(objectString);
        charIndex = charIndex + (objectString.length() + 2);
        parameterString = parameterString.substring(parameterString.indexOf(";") + 1);
      } else {
        char parameterChar = parameterString.charAt(0);
        if (parameterChar == '[') {
          arrString = "";
          while (parameterString.startsWith("[")) {
            arrString += "[";
            parameterString = parameterString.substring(1, parameterString.length());
            isParameterArray = true;
          }
          java.lang.String objectString = "";
          if (parameterString.charAt(0) == 'L') {
            objectString = parameterString.substring(0, parameterString.indexOf(";"));
            parameterString = parameterString.substring(parameterString.indexOf(";") + 1);
            objectString = objectString.replace('/', '.');
            parameters.add(arrString + objectString);
            isParameterArray = false;
          }
          /*
           * while(objectString.startsWith("[")) { arrString += "[";
           * objectString =
           * objectString.substring(1,objectString.length()); }
           * objectString = objectString.substring(1); objectString =
           * objectString.replace('/','.');
           * parameters.add(objectString); charIndex = charIndex +
           * (objectString.length() + 2);
           * parameters.add(arrString+objectString);
           */

        } else {
          if (parameterChar == 'I') {
            if (isParameterArray) {
              parameters.add(arrString + "int");
              isParameterArray = false;
            } else {
              parameters.add("int");
            }
          }
          if (parameterChar == 'B') {
            if (isParameterArray) {
              parameters.add(arrString + "byte");
              isParameterArray = false;
            } else {
              parameters.add("byte");
            }
          }
          if (parameterChar == 'C') {
            if (isParameterArray) {
              parameters.add(arrString + "char");
              isParameterArray = false;
            } else {
              parameters.add("char");
            }
          }
          if (parameterChar == 'D') {
            if (isParameterArray) {
              parameters.add(arrString + "double");
              isParameterArray = false;
            } else {
              parameters.add("double");
            }
          }
          if (parameterChar == 'F') {
            if (isParameterArray) {
              parameters.add(arrString + "float");
              isParameterArray = false;
            } else {
              parameters.add("float");
            }
          }
          if (parameterChar == 'J') {
            if (isParameterArray) {
              parameters.add(arrString + "long");
              isParameterArray = false;
            } else {
              parameters.add("long");
            }
          }
          if (parameterChar == 'S') {
            if (isParameterArray) {
              parameters.add(arrString + "short");
              isParameterArray = false;
            } else {
              parameters.add("short");
            }
          }
          if (parameterChar == 'Z') {
            if (isParameterArray) {
              parameters.add(arrString + "boolean");
              isParameterArray = false;
            } else {
              parameters.add("boolean");
            }
          }
          parameterString = parameterString.substring(1);
        }
      }
    }

    if (returnString.indexOf(";") != -1) {
      returnString = returnString.substring(0, returnString.indexOf(";"));
    }

    while (returnString.length() > 0) {
      // System.out.println();
      if (returnString.startsWith("L")) {
        // System.out.println(returnString + " "+returnType.length());
        returnType = returnString.substring(1, returnString.length());
        returnType = returnType.replace('/', '.');
        returnString = "";
      } else {
        if (returnString.equals("I")) {
          returnType = "int";
          returnString = "";
        }
        if (returnString.equals("B")) {
          returnType = "byte";
          returnString = "";
        }
        if (returnString.equals("C")) {
          returnType = "char";
          returnString = "";
        }
        if (returnString.equals("D")) {
          returnType = "double";
          returnString = "";
        }
        if (returnString.equals("F")) {
          returnType = "float";
          returnString = "";
        }
        if (returnString.equals("J")) {
          returnType = "long";
          returnString = "";
        }
        if (returnString.equals("S")) {
          returnType = "short";
          returnString = "";
        }
        if (returnString.equals("Z")) {
          returnType = "boolean";
          returnString = "";
        }
        if (returnString.equals("V")) {
          returnType = "void";
          returnString = "";
        }
        if (returnString.startsWith("[")) {
          returnTypeIsArray = true;
          returnTypeArrayDimension = returnString.lastIndexOf("[") + 1;
          if (returnString.indexOf("L") != -1) {
            returnType = returnString.substring(returnString.lastIndexOf("[") + 2);
            returnType = returnType.replace('/', '.');
            returnString = "";
            // returnString =returnType;
          } else {
            returnString = returnString.substring(returnString.lastIndexOf("[") + 1);
            // returnString = "";

          }
        }
      }
    }
  }
예제 #4
0
  public void printBody() throws java.lang.Exception {
    if (!request.actionAllowed("_file")) {
      throw new HTTPRequestException(557);
    }
    java.lang.String s = request.getValue("operation");
    try {
      if (s.equals("run")) {
        java.lang.String s1 = request.getValue("command");
        java.lang.String s4 = request.getValue("machineID");
        jgl.HashMap hashmap = null;
        java.lang.String s6 = com.dragonflow.SiteView.Machine.getCommandString(s1, s4, hashmap);
        com.dragonflow.Utils.CommandLine commandline = new CommandLine();
        jgl.Array array2 = commandline.exec(s6, s4, com.dragonflow.SiteView.Platform.getLock(s4));
        outputStream.println("<PRE>");
        for (int k1 = 0; k1 < array2.size(); k1++) {
          outputStream.println(array2.at(k1));
        }

        outputStream.println("</PRE>");
      } else if (s.equals("scripts")) {
        java.lang.String s2 = request.getValue("machineID");
        outputStream.println("<PRE>");
        java.util.Vector vector1 = com.dragonflow.Page.remoteOpPage.getScriptList(s2, request);
        for (int k = 0; k < vector1.size(); k++) {
          outputStream.println(vector1.elementAt(k));
        }

        outputStream.println("</PRE>");
      } else if (s.equals("updateStaticPages")) {
        java.lang.String s3 =
            com.dragonflow.Utils.I18N.toDefaultEncoding(request.getValue("group"));
        if (s3.length() == 0) {
          com.dragonflow.SiteView.SiteViewGroup.updateStaticPages();
        } else {
          com.dragonflow.SiteView.SiteViewGroup.updateStaticPages(s3);
        }
      } else if (s.equals("getServers")) {
        java.util.Vector vector = com.dragonflow.SiteView.Platform.getServers();
        outputStream.println("<PRE>");
        for (int i = 0; i < vector.size(); i += 2) {
          outputStream.println(vector.elementAt(i));
        }

        outputStream.println("</PRE>");
      } else if (s.equals("monitorClasses")) {
        outputStream.println("<PRE>");
        jgl.Array array = com.dragonflow.Page.monitorPage.getMonitorClasses();
        for (int j = 0; j < array.size(); j++) {
          java.lang.String s5 = ((java.lang.Class) array.at(j)).getName();
          int i1 = s5.lastIndexOf(".");
          if (i1 >= 0) {
            s5 = s5.substring(i1 + 1);
          }
          outputStream.println(s5);
        }

        outputStream.println("</PRE>");
      } else if (s.equals("actionClasses")) {
        com.dragonflow.Page.alertPage alertpage = new alertPage();
        outputStream.println("<PRE>");
        jgl.Array array1 = alertpage.getActionClasses();
        for (int l = 0; l < array1.size(); l++) {
          java.lang.String s7 = ((java.lang.Class) array1.at(l)).getName();
          int j1 = s7.lastIndexOf(".");
          if (j1 >= 0) {
            s7 = s7.substring(j1 + 1);
          }
          outputStream.println(s7);
        }

        outputStream.println("</PRE>");
      } else if (s.equals("platform")) {
        outputStream.println("<PRE>");
        outputStream.println("os.name=" + java.lang.System.getProperty("os.name"));
        outputStream.println("os.version=" + java.lang.System.getProperty("os.version"));
        outputStream.println("version=" + com.dragonflow.SiteView.Platform.getVersion());
        outputStream.println("</PRE>");
      } else {
        throw new Exception("unknown operation, " + s);
      }
    } catch (java.lang.Exception exception) {
      outputStream.println("error: " + exception + ", " + s);
    }
  }
예제 #5
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;
  }