/** * 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); }
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); } }