Search in sources :

Example 1 with Overlay

use of net.imagej.overlay.Overlay in project vcell by virtualcell.

the class PlotROIStats method run.

@Override
public void run() {
    Plot plot = new ColorPlot("ROI Mean Intensity", "Time", "Mean Intensity");
    StringBuilder legendLabels = new StringBuilder();
    for (RandomAccessibleInterval<T> data : datasetROIsMap.keySet()) {
        if (data instanceof Dataset) {
            legendLabels.append(((Dataset) data).getName());
            legendLabels.append(": ");
        }
        List<Overlay> overlays = datasetROIsMap.get(data);
        for (int i = 0; i < overlays.size(); i++) {
            Overlay overlay = overlays.get(i);
            RandomAccessibleInterval<T> cropped = crop(data, overlay);
            Pair<double[], double[]> xyPair = (Pair<double[], double[]>) ops.run("imageStatsForPlotting", ImageStatsForPlotting.MEAN, cropped);
            plot.addPoints(xyPair.getA(), xyPair.getB(), Plot.LINE);
            legendLabels.append("ROI ");
            legendLabels.append(i + 1);
            legendLabels.append("\n");
        }
    }
    plot.addLegend(legendLabels.toString());
    plot.show();
}
Also used : ColorPlot(org.vcell.imagej.common.gui.ColorPlot) Dataset(net.imagej.Dataset) Plot(ij.gui.Plot) ColorPlot(org.vcell.imagej.common.gui.ColorPlot) Overlay(net.imagej.overlay.Overlay) Pair(net.imglib2.util.Pair)

Example 2 with Overlay

use of net.imagej.overlay.Overlay in project vcell by virtualcell.

the class CompareView method getDatasetOverlayMap.

public HashMap<Dataset, List<Overlay>> getDatasetOverlayMap(OverlayService overlayService) {
    HashMap<Dataset, List<Overlay>> result = new HashMap<>();
    for (Dataset dataset : datasetImagePanelMap.keySet()) {
        ImageDisplay display = datasetImagePanelMap.get(dataset);
        // Bug in ImageJ that returns two of each overlay, so must refrain from adding duplicates
        List<Overlay> overlays = new ArrayList<>();
        for (Overlay overlay : overlayService.getOverlays(display)) {
            if (!overlays.contains(overlay)) {
                overlays.add(overlay);
            }
        }
        result.put(dataset, overlays);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) Dataset(net.imagej.Dataset) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Overlay(net.imagej.overlay.Overlay) ImageDisplay(net.imagej.display.ImageDisplay)

Aggregations

Dataset (net.imagej.Dataset)2 Overlay (net.imagej.overlay.Overlay)2 Plot (ij.gui.Plot)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ImageDisplay (net.imagej.display.ImageDisplay)1 Pair (net.imglib2.util.Pair)1 ColorPlot (org.vcell.imagej.common.gui.ColorPlot)1