コード例 #1
0
 /** Sets Tesseract's internal parameters. */
 private void setTessVariables() {
   Enumeration<?> em = prop.propertyNames();
   while (em.hasMoreElements()) {
     String key = (String) em.nextElement();
     api.TessBaseAPISetVariable(handle, key, prop.getProperty(key));
   }
 }
コード例 #2
0
 public void actionPerformed(java.awt.event.ActionEvent arg0) {
   JPanel4.showCard("router"); // No Internationalisation
   Properties prop = (Properties) routerobject.elementAt(0);
   ((com.adventnet.nms.examples.routermap.RouterDetails) JPanel4.getCard("router"))
       .setValues((Properties) routerobject.elementAt(0)); // No Internationalisation
   JLabel1.setText(
       NmsClientUtil.GetString("Router details  :  ")
           + prop.getProperty("name")); // No Internationalisation
 }
コード例 #3
0
ファイル: ImageJ.java プロジェクト: chrisp87/ImageJA
 /** Called once when ImageJ quits. */
 public void savePreferences(Properties prefs) {
   Point loc = getLocation();
   prefs.put(IJ_X, Integer.toString(loc.x));
   prefs.put(IJ_Y, Integer.toString(loc.y));
   // prefs.put(IJ_WIDTH, Integer.toString(size.width));
   // prefs.put(IJ_HEIGHT, Integer.toString(size.height));
 }
コード例 #4
0
ファイル: ImageJ.java プロジェクト: chrisp87/ImageJA
 void configureProxy() {
   if (Prefs.useSystemProxies) {
     try {
       System.setProperty("java.net.useSystemProxies", "true");
     } catch (Exception e) {
     }
   } else {
     String server = Prefs.get("proxy.server", null);
     if (server == null || server.equals("")) return;
     int port = (int) Prefs.get("proxy.port", 0);
     if (port == 0) return;
     Properties props = System.getProperties();
     props.put("proxySet", "true");
     props.put("http.proxyHost", server);
     props.put("http.proxyPort", "" + port);
   }
   // new ProxySettings().logProperties();
 }
コード例 #5
0
ファイル: FileOpener.java プロジェクト: earrouvi/PAPPL
 private Double getNumber(Properties props, String key) {
   String s = props.getProperty(key);
   if (s != null) {
     try {
       return Double.valueOf(s);
     } catch (NumberFormatException e) {
     }
   }
   return null;
 }
コード例 #6
0
ファイル: FileOpener.java プロジェクト: earrouvi/PAPPL
 public Properties decodeDescriptionString(FileInfo fi) {
   if (fi.description == null || fi.description.length() < 7) return null;
   if (IJ.debugMode) IJ.log("Image Description: " + new String(fi.description).replace('\n', ' '));
   if (!fi.description.startsWith("ImageJ")) return null;
   Properties props = new Properties();
   InputStream is = new ByteArrayInputStream(fi.description.getBytes());
   try {
     props.load(is);
     is.close();
   } catch (IOException e) {
     return null;
   }
   fi.unit = props.getProperty("unit", "");
   Double n = getNumber(props, "cf");
   if (n != null) fi.calibrationFunction = n.intValue();
   double c[] = new double[5];
   int count = 0;
   for (int i = 0; i < 5; i++) {
     n = getNumber(props, "c" + i);
     if (n == null) break;
     c[i] = n.doubleValue();
     count++;
   }
   if (count >= 2) {
     fi.coefficients = new double[count];
     for (int i = 0; i < count; i++) fi.coefficients[i] = c[i];
   }
   fi.valueUnit = props.getProperty("vunit");
   n = getNumber(props, "images");
   if (n != null && n.doubleValue() > 1.0) fi.nImages = (int) n.doubleValue();
   if (fi.nImages > 1) {
     double spacing = getDouble(props, "spacing");
     if (spacing != 0.0) {
       if (spacing < 0) spacing = -spacing;
       fi.pixelDepth = spacing;
     }
   }
   return props;
 }
コード例 #7
0
ファイル: FileOpener.java プロジェクト: earrouvi/PAPPL
 private boolean getBoolean(Properties props, String key) {
   String s = props.getProperty(key);
   return s != null && s.equals("true") ? true : false;
 }
コード例 #8
0
ファイル: FileOpener.java プロジェクト: earrouvi/PAPPL
  void setCalibration(ImagePlus imp) {
    if (fi.fileType == FileInfo.GRAY16_SIGNED) {
      if (IJ.debugMode) IJ.log("16-bit signed");
      double[] coeff = new double[2];
      coeff[0] = -32768.0;
      coeff[1] = 1.0;
      imp.getLocalCalibration().setFunction(Calibration.STRAIGHT_LINE, coeff, "gray value");
    }

    Properties props = decodeDescriptionString(fi);
    Calibration cal = imp.getCalibration();
    boolean calibrated = false;
    if (fi.pixelWidth > 0.0 && fi.unit != null) {
      cal.pixelWidth = fi.pixelWidth;
      cal.pixelHeight = fi.pixelHeight;
      cal.pixelDepth = fi.pixelDepth;
      cal.setUnit(fi.unit);
      calibrated = true;
    }

    if (fi.valueUnit != null) {
      int f = fi.calibrationFunction;
      if ((f >= Calibration.STRAIGHT_LINE && f <= Calibration.RODBARD2 && fi.coefficients != null)
          || f == Calibration.UNCALIBRATED_OD) {
        boolean zeroClip = props != null && props.getProperty("zeroclip", "false").equals("true");
        cal.setFunction(f, fi.coefficients, fi.valueUnit, zeroClip);
        calibrated = true;
      }
    }

    if (calibrated) checkForCalibrationConflict(imp, cal);

    if (fi.frameInterval != 0.0) cal.frameInterval = fi.frameInterval;

    if (props == null) return;

    cal.xOrigin = getDouble(props, "xorigin");
    cal.yOrigin = getDouble(props, "yorigin");
    cal.zOrigin = getDouble(props, "zorigin");
    cal.info = props.getProperty("info");

    cal.fps = getDouble(props, "fps");
    cal.loop = getBoolean(props, "loop");
    cal.frameInterval = getDouble(props, "finterval");
    cal.setTimeUnit(props.getProperty("tunit", "sec"));

    double displayMin = getDouble(props, "min");
    double displayMax = getDouble(props, "max");
    if (!(displayMin == 0.0 && displayMax == 0.0)) {
      int type = imp.getType();
      ImageProcessor ip = imp.getProcessor();
      if (type == ImagePlus.GRAY8 || type == ImagePlus.COLOR_256)
        ip.setMinAndMax(displayMin, displayMax);
      else if (type == ImagePlus.GRAY16 || type == ImagePlus.GRAY32) {
        if (ip.getMin() != displayMin || ip.getMax() != displayMax)
          ip.setMinAndMax(displayMin, displayMax);
      }
    }

    int stackSize = imp.getStackSize();
    if (stackSize > 1) {
      int channels = (int) getDouble(props, "channels");
      int slices = (int) getDouble(props, "slices");
      int frames = (int) getDouble(props, "frames");
      if (channels == 0) channels = 1;
      if (slices == 0) slices = 1;
      if (frames == 0) frames = 1;
      // IJ.log("setCalibration: "+channels+"  "+slices+"  "+frames);
      if (channels * slices * frames == stackSize) {
        imp.setDimensions(channels, slices, frames);
        if (getBoolean(props, "hyperstack")) imp.setOpenAsHyperStack(true);
      }
    }
  }
コード例 #9
0
  void refresh() {

    JPanel4.showCard("router"); // No Internationalisation
    if (routerobject != null) {
      ((com.adventnet.nms.examples.routermap.RouterDetails) JPanel4.getCard("router"))
          .setValues((Properties) routerobject.elementAt(0)); // No Internationalisation
      Properties prop = (Properties) routerobject.elementAt(0);
      RouterBtn.setBackground(
          SeverityInfo.getInstance()
              .getColor(Integer.parseInt(prop.getProperty("status")))); // No Internationalisation
      RouterBtn.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
      JLabel1.setText(
          NmsClientUtil.GetString("Router details  :  ")
              + prop.getProperty("name")); // No Internationalisation
    }
    if (routerobject.size() >= 2) {
      one.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(1);
      one.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      one.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 3) {
      two.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(2);
      two.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      two.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 4) {
      three.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(3);
      three.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      three.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 5) {
      four.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(4);
      four.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      four.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 6) {
      five.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(5);
      five.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      five.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 7) {
      six.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(6);
      six.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      six.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 8) {
      seven.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(7);
      seven.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      seven.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 9) {
      eight.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(8);
      eight.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      eight.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 10) {
      nine.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(9);
      nine.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      nine.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 11) {
      ten.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(10);
      ten.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      ten.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
  }
コード例 #10
0
 /**
  * Set the value of Tesseract's internal parameter.
  *
  * @param key variable name, e.g., <code>tessedit_create_hocr</code>, <code>
  *     tessedit_char_whitelist</code>, etc.
  * @param value value for corresponding variable, e.g., "1", "0", "0123456789", etc.
  */
 public void setTessVariable(String key, String value) {
   prop.setProperty(key, value);
 }
コード例 #11
0
 /**
  * Enables hocr output.
  *
  * @param hocr to enable or disable hocr output
  */
 public void setHocr(boolean hocr) {
   this.hocr = hocr;
   prop.setProperty("tessedit_create_hocr", hocr ? "1" : "0");
 }