예제 #1
0
  /** Execute algorithm */
  public void evaluate(Flow flow, FlowExec exec) throws Exception {
    Map<String, Object> lastOutput = exec.getLastOutputCleared(this);
    AnyEvImage a = (AnyEvImage) flow.getInputValue(this, exec, "image");

    AnyEvImage out = new EvOpThresholdOtsu2D().exec1Untyped(exec.ph, a);
    lastOutput.put("out", out);
  }
  /** Execute algorithm */
  public void evaluate(Flow flow, FlowExec exec) throws Exception {
    Map<String, Object> lastOutput = exec.getLastOutputCleared(this);

    AnyEvImage a = (AnyEvImage) flow.getInputValue(this, exec, "image");
    MorphKernel kernel = (MorphKernel) flow.getInputValue(this, exec, "kernel");

    lastOutput.put("out", new EvOpMorphGradientWhole2D(kernel).exec1Untyped(a));
  }
  /** Execute algorithm */
  public void evaluate(Flow flow, FlowExec exec) throws Exception {
    Map<String, Object> lastOutput = exec.getLastOutputCleared(this);
    AnyEvImage inReal = (AnyEvImage) flow.getInputValue(this, exec, "inReal");
    Maybe<AnyEvImage> inImag = flow.getInputValueMaybe(this, exec, "inImag", AnyEvImage.class);
    //		Object inImag=flow.getInputValue(this, exec, "inImag");

    //	checkNotNull(inReal);

    if (!inImag.hasValue()) {
      AnyEvImage[] outs = new EvOpFourierRealInverseFull3D(true).execUntyped(inReal);
      lastOutput.put("outReal", outs[0]);
      lastOutput.put("outImag", outs[1]); // Could use half-inverse and generate special image?
    } else {
      AnyEvImage[] outs = new EvOpFourierComplexInverse3D(true).execUntyped(inReal, inImag.get());
      lastOutput.put("outReal", outs[0]);
      lastOutput.put("outImag", outs[1]);
    }
  }
  public void evaluate(Flow flow, FlowExec exec) throws Exception {
    Map<String, Object> lastOutput = exec.getLastOutput(this);
    lastOutput.clear();
    Object a = flow.getInputValue(this, exec, "A");
    Object b = flow.getInputValue(this, exec, "B");

    checkNotNull(a, b);
    if (a instanceof Number && b instanceof Number)
      lastOutput.put("C", NumberMath.div((Number) a, (Number) b));
    else if (a instanceof AnyEvImage && b instanceof Number)
      lastOutput.put("C", new EvOpImageDivScalar((Number) b).exec1Untyped((AnyEvImage) a));
    else if (b instanceof AnyEvImage && a instanceof Number)
      lastOutput.put("C", new EvOpScalarDivImage((Number) a).exec1Untyped((AnyEvImage) b));
    else if (a instanceof AnyEvImage && b instanceof AnyEvImage)
      lastOutput.put("C", new EvOpImageDivImage().exec1Untyped((AnyEvImage) a, (AnyEvImage) b));
    else
      throw new BadTypeFlowException(
          "Unsupported numerical types " + a.getClass() + " & " + b.getClass());
  }
  /** Execute algorithm */
  public void evaluate(Flow flow, FlowExec exec) throws Exception {
    Map<String, Object> lastOutput = exec.getLastOutputCleared(this);

    // Object a=flow.getInputValue(this, exec, "image");
    AnyEvImage in = (AnyEvImage) flow.getInputValue(this, exec, "image");

    if (in instanceof EvPixels) {
      EvStack stack = new EvStack();
      stack.setTrivialResolution();
      stack.putInt(0, new EvImage((EvPixels) in));
      EvChannel chan = new EvChannel();
      chan.imageLoader.put(new EvDecimal(0), stack);
      lastOutput.put("out", chan);
    } else if (in instanceof EvStack) {
      EvChannel chan = new EvChannel();
      chan.imageLoader.put(new EvDecimal(0), (EvStack) in);
      lastOutput.put("out", chan);
    } else if (in instanceof EvChannel) lastOutput.put("out", in);
  }