예제 #1
0
  /*
   * Generate PBE Algorithm Parameters
   */
  private AlgorithmParameters getAlgorithmParameters(String algorithm) throws IOException {
    AlgorithmParameters algParams = null;

    // create PBE parameters from salt and iteration count
    PBEParameterSpec paramSpec = new PBEParameterSpec(getSalt(), iterationCount);
    try {
      algParams = AlgorithmParameters.getInstance(algorithm);
      algParams.init(paramSpec);
    } catch (Exception e) {
      IOException ioe = new IOException("getAlgorithmParameters failed: " + e.getMessage());
      ioe.initCause(e);
      throw ioe;
    }
    return algParams;
  }
예제 #2
0
 /*
  * parse Algorithm Parameters
  */
 private AlgorithmParameters parseAlgParameters(DerInputStream in) throws IOException {
   AlgorithmParameters algParams = null;
   try {
     DerValue params;
     if (in.available() == 0) {
       params = null;
     } else {
       params = in.getDerValue();
       if (params.tag == DerValue.tag_Null) {
         params = null;
       }
     }
     if (params != null) {
       algParams = AlgorithmParameters.getInstance("PBE");
       algParams.init(params.toByteArray());
     }
   } catch (Exception e) {
     IOException ioe = new IOException("parseAlgParameters failed: " + e.getMessage());
     ioe.initCause(e);
     throw ioe;
   }
   return algParams;
 }
예제 #3
0
  /**
   * Returns a table listing the input parameters of this algorithm (which should match up with the
   * scripting parameters used in {@link #setGUIFromParams()}).
   *
   * @return A parameter table listing the inputs of this algorithm.
   */
  public ParameterTable createInputParameters() {
    final ParameterTable table = new ParameterTable();

    try {

      table.put(new ParameterExternalImage(AlgorithmParameters.getInputImageLabel(1)));
      table.put(new ParameterBoolean(AlgorithmParameters.DO_OUTPUT_NEW_IMAGE, true));
    } catch (final ParserException e) {
      // this shouldn't really happen since there isn't any real parsing going on...
      e.printStackTrace();
    }

    return table;
  }
  /**
   * Returns a table listing the input parameters of this algorithm (which should match up with the
   * scripting parameters used in {@link #setGUIFromParams()}).
   *
   * @return A parameter table listing the inputs of this algorithm.
   */
  public ParameterTable createInputParameters() {
    final ParameterTable table = new ParameterTable();

    try {
      table.put(new ParameterExternalImage(AlgorithmParameters.getInputImageLabel(1)));
      table.put(new ParameterBoolean(AlgorithmParameters.DO_OUTPUT_NEW_IMAGE, true));
      table.put(new ParameterBoolean(AlgorithmParameters.DO_PROCESS_WHOLE_IMAGE, true));
      table.put(new ParameterBoolean(AlgorithmParameters.DO_PROCESS_3D_AS_25D, false));
      table.put(new ParameterInt("search_window_side", 15));
      table.put(new ParameterInt("similarity_window_side", 7));
      table.put(new ParameterFloat("noise_standard_deviation", 10f));
      table.put(new ParameterFloat("degree_of_filtering", 1.414f));
      table.put(new ParameterBoolean("do_rician", false));
    } catch (final ParserException e) {
      // this shouldn't really happen since there isn't any real parsing going on...
      e.printStackTrace();
    }

    return table;
  }
  /**
   * Store the result image in the script runner's image table now that the action execution is
   * finished.
   */
  protected void doPostAlgorithmActions() {

    if (displayLoc == NEW) {
      AlgorithmParameters.storeImageInRunner(getResultImage());
    }
  }