示例#1
0
  /**
   * Extract the plane at the different positions and concatenate the Dataset
   *
   * @param newValue
   * @return
   */
  private CallbackTask<Void, Void> createSampleImage(File newValue) {
    return new CallbackTask<Void, Void>()
        .run(
            () -> {
              try {
                File fileTarget = workflowModel.getMapImages().get(newValue);
                Dataset datasetTarget = (Dataset) iOService.open(fileTarget.getAbsolutePath());
                ImageDisplay imageDisplayTarget = new SilentImageDisplay();
                context.inject(imageDisplayTarget);
                imageDisplayTarget.display(datasetTarget);
                selectPosition(
                    imageDisplayTarget,
                    workflowModel.getPositionLeft(),
                    workflowModel.getPositionRight(),
                    imageDisplayPaneRight);

                Dataset datasetSource = (Dataset) iOService.open(newValue.getAbsolutePath());
                ImageDisplay imageDisplaySource = new SilentImageDisplay();
                context.inject(imageDisplaySource);
                imageDisplaySource.display(datasetSource);
                selectPosition(
                    imageDisplaySource,
                    workflowModel.getPositionLeft(),
                    workflowModel.getPositionRight(),
                    imageDisplayPaneLeft);

              } catch (IOException ex) {
                Logger.getLogger(ProcessWorkflow.class.getName()).log(Level.SEVERE, null, ex);
              }
            })
        .submit(loadingScreenService);
  }
  @Override
  public void setItem(WorkflowStep t) {

    if (configPane == null) {
      configPane = new ModuleConfigPane();
      context.inject(configPane);

      popover.setContentNode(configPane);
      // popover.setAnchorLocation(PopupWindow.AnchorLocation.WINDOW_TOP_RIGHT);
      popover.setArrowLocation(PopOver.ArrowLocation.RIGHT_TOP);
    }
    this.step = t;

    configPane.configure(step);

    titleLabel.setText(step.getModule().getInfo().getTitle());
  }
示例#3
0
  public OpViewer(final Context context) {
    super("Op Viewer");
    context.inject(this);

    // Load the frame size
    loadPreferences();

    // Top node of the JTree
    final DefaultMutableTreeNode top = new DefaultMutableTreeNode("Available Ops");
    createNodes(top);

    final JTree tree = new JTree(top);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    // Make the JTree scrollable
    final JScrollPane pane =
        new JScrollPane(
            tree,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    setContentPane(pane);

    try {
      if (SwingUtilities.isEventDispatchThread()) {
        pack();
      } else {
        SwingUtilities.invokeAndWait(
            new Runnable() {

              @Override
              public void run() {
                pack();
              }
            });
      }
    } catch (final Exception ie) {
      /* ignore */
    }

    setLocationRelativeTo(null); // center on screen
    requestFocus();
  }
  public void dummySegmentation() {

    List<Dataset> predictDataset = new ArrayList<>(imgDatasets.size());

    INDArray predict = dummyClassification();
    int currIdx = 0;

    for (int ds = 0; ds < imgDatasets.size(); ds++) {
      List<List<int[]>> profilesSet = testData.get(ds).getProfiles();

      predictDataset.add(imagePlaneService.createEmptyPlaneDataset(imgDatasets.get(ds)));

      Dataset currDataset = predictDataset.get(ds);

      RandomAccess<RealType<?>> randomAccess = currDataset.randomAccess();

      for (List<int[]> p : profilesSet) {
        for (int i = 0; i < p.size(); i++) {
          randomAccess.setPosition(p.get(i)[0], 0);
          randomAccess.setPosition(p.get(i)[1], 1);

          double value = predict.getRow(currIdx).getDouble(i);
          if (value != 0) randomAccess.get().setReal(value);
        }
      }
      Overlay[] overlays = BinaryToOverlay.transform(context, currDataset, true);
      //            List<Overlay> overlayList = Arrays.asList(BinaryToOverlay.transform(context,
      // currDataset, true));
      overlayStatService.setRandomColor(Arrays.asList(overlays));
      ImageDisplay display = new DefaultImageDisplay();
      context.inject(display);
      display.display(currDataset);
      for (Overlay o : overlays) {
        display.display(o);
      }
      uis.show(display);
    }
  }
示例#5
0
 public ScriptREPL(final Context context, final OutputStream out) {
   context.inject(this);
   this.out = out instanceof PrintStream ? (PrintStream) out : new PrintStream(out);
 }
示例#6
0
 @Override
 public void setContext(final Context context) {
   context.inject(this);
 }