Search in sources :

Example 36 with Plot

use of ij.gui.Plot in project GDSC-SMLM by aherbert.

the class BackgroundEstimator method plot.

private void plot(WindowOrganiser wo, double[] xvalues, double[] data1, double[] data2, double[] data3, String title, String title1, String title2, String title3) {
    // Get limits
    final double[] xlimits = MathUtils.limits(xvalues);
    double[] ylimits = MathUtils.limits(data1);
    ylimits = MathUtils.limits(ylimits, data2);
    if (data3 != null) {
        ylimits = MathUtils.limits(ylimits, data3);
    }
    title = imp.getTitle() + " " + title;
    final Plot plot = new Plot(title, "Slice", title);
    double range = ylimits[1] - ylimits[0];
    if (range == 0) {
        range = 1;
    }
    plot.setLimits(xlimits[0], xlimits[1], ylimits[0] - 0.05 * range, ylimits[1] + 0.05 * range);
    plot.setColor(Color.blue);
    plot.addPoints(xvalues, data1, Plot.LINE);
    plot.draw();
    Statistics stats = Statistics.create(data1);
    @SuppressWarnings("resource") final Formatter label = new Formatter().format("%s (Blue) = %s +/- %s", title1, MathUtils.rounded(stats.getMean()), MathUtils.rounded(stats.getStandardDeviation()));
    plot.setColor(Color.red);
    plot.addPoints(xvalues, data2, Plot.LINE);
    stats = Statistics.create(data2);
    label.format(", %s (Red) = %s +/- %s", title2, MathUtils.rounded(stats.getMean()), MathUtils.rounded(stats.getStandardDeviation()));
    if (data3 != null) {
        plot.setColor(Color.green);
        plot.addPoints(xvalues, data3, Plot.LINE);
        stats = Statistics.create(data3);
        label.format(", %s (Green) = %s +/- %s", title3, MathUtils.rounded(stats.getMean()), MathUtils.rounded(stats.getStandardDeviation()));
    }
    plot.setColor(Color.black);
    plot.addLabel(0, 0, label.toString());
    ImageJUtils.display(title, plot, wo);
}
Also used : Formatter(java.util.Formatter) Plot(ij.gui.Plot) Statistics(uk.ac.sussex.gdsc.core.utils.Statistics)

Example 37 with Plot

use of ij.gui.Plot in project GDSC-SMLM by aherbert.

the class BlinkEstimator method plot.

private static void plot(String xAxisTitle, String yAxisTitle, double[] x, double[] y) {
    final String title = TITLE + " " + yAxisTitle;
    final Plot plot = new Plot(title, xAxisTitle, yAxisTitle);
    plot.addPoints(x, y, Plot.LINE);
    ImageJUtils.display(title, plot);
}
Also used : Plot(ij.gui.Plot)

Example 38 with Plot

use of ij.gui.Plot in project vcell by virtualcell.

the class PlotImageStats method run.

@Override
public void run() {
    Plot plot = new ColorPlot("Frame mean intensity", "Time", "Mean intensity");
    StringBuilder legendLabels = new StringBuilder();
    for (int i = 0; i < datasets.size(); i++) {
        RandomAccessibleInterval<T> data = datasets.get(i);
        if (data instanceof Dataset) {
            legendLabels.append(((Dataset) data).getName());
            legendLabels.append(": ");
        }
        Pair<double[], double[]> xyPair = (Pair<double[], double[]>) ops.run("imageStatsForPlotting", ImageStatsForPlotting.MEAN, data, mask);
        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) Pair(net.imglib2.util.Pair)

Example 39 with Plot

use of ij.gui.Plot 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 40 with Plot

use of ij.gui.Plot in project mcib3d-core by mcib3d.

the class ArrayUtil method getPlot.

public Plot getPlot(String title, String xLabel, String yLabel) {
    double[] xVal = new double[size];
    for (int i = 0; i < xVal.length; i++) {
        xVal[i] = i;
    }
    Plot plot = new Plot(title, xLabel, yLabel, xVal, values);
    plot.draw();
    return plot;
}
Also used : Plot(ij.gui.Plot)

Aggregations

Plot (ij.gui.Plot)89 HistogramPlot (uk.ac.sussex.gdsc.core.ij.HistogramPlot)20 Point (java.awt.Point)19 PlotWindow (ij.gui.PlotWindow)17 Color (java.awt.Color)13 WindowOrganiser (uk.ac.sussex.gdsc.core.ij.plugin.WindowOrganiser)13 HistogramPlotBuilder (uk.ac.sussex.gdsc.core.ij.HistogramPlot.HistogramPlotBuilder)12 BasePoint (uk.ac.sussex.gdsc.core.match.BasePoint)12 ExtendedGenericDialog (uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog)11 MemoryPeakResults (uk.ac.sussex.gdsc.smlm.results.MemoryPeakResults)11 Rectangle (java.awt.Rectangle)9 ArrayList (java.util.ArrayList)9 GenericDialog (ij.gui.GenericDialog)8 NonBlockingExtendedGenericDialog (uk.ac.sussex.gdsc.core.ij.gui.NonBlockingExtendedGenericDialog)7 LocalList (uk.ac.sussex.gdsc.core.utils.LocalList)7 Statistics (uk.ac.sussex.gdsc.core.utils.Statistics)7 StoredData (uk.ac.sussex.gdsc.core.utils.StoredData)7 StoredDataStatistics (uk.ac.sussex.gdsc.core.utils.StoredDataStatistics)7 ImagePlus (ij.ImagePlus)6 TDoubleArrayList (gnu.trove.list.array.TDoubleArrayList)5