Java Code Examples for ij.gui.Plot#setLimits()

The following examples show how to use ij.gui.Plot#setLimits() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Compare.java    From TrakEM2 with GNU General Public License v3.0 6 votes vote down vote up
static public Plot makePlot(final CATAParameters cp, final String name, final VectorString3D c) {
	final double[] stdDev = c.getStdDevAtEachPoint();
	if (null == stdDev) return null;
	final double[] index = new double[stdDev.length];
	for (int i=0; i<index.length; i++) index[i] = i;
	Utils.log2("name is " + name);
	Utils.log2("c is " + c);
	Utils.log2("cp is " + cp);
	Utils.log2("stdDev is " + stdDev);
	Utils.log2("c.getCalibrationCopy() is " + c.getCalibrationCopy());
	Utils.log2("c.getDelta() is " + c.getDelta());
	final Calibration cal = c.getCalibrationCopy();
	if (null == cal) Utils.log2("WARNING null calibration!");
	final Plot plot = new Plot(name, name + " -- Point index (delta: " + Utils.cutNumber(c.getDelta(), 2) + " " + (null == cal ? "pixels" : cal.getUnits()) + ")", "Std Dev", index, stdDev);
	plot.setLimits(0, cp.plot_max_x, 0, cp.plot_max_y);
	plot.setSize(cp.plot_width, cp.plot_height);
	plot.setLineWidth(2);
	return plot;
}
 
Example 2
Source File: AbstractCalibrationProcess.java    From thunderstorm with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void drawSigmaPlots() {
    // config
    SigmaPlotConfig cfg = new SigmaPlotConfig();
    cfg.allFrames = allFrames;
    cfg.allSigma1s = allSigma1s;
    cfg.allSigma2s = allSigma2s;
    cfg.allPolynomsS1 = allPolynomsS1;
    cfg.allPolynomsS2 = allPolynomsS2;
    cfg.polynomS1Final = polynomS1Final;
    cfg.polynomS2Final = polynomS2Final;
    cfg.allSigma1sColor = new Color(255, 200, 200);
    cfg.allSigma2sColor = new Color(200, 200, 255);
    cfg.allPolynomsS1Color = new Color(255, 230, 230);
    cfg.allPolynomsS2Color = new Color(230, 230, 255);
    cfg.polynomS1FinalColor = new Color(255, 0, 0);
    cfg.polynomS2FinalColor = new Color(0, 0, 255);
    cfg.legend1X = 0.1;
    cfg.legend1Y = 0.8;
    cfg.legend1Label = "sigma1";
    cfg.legend2X = 0.1;
    cfg.legend2Y = 0.9;
    cfg.legend2Label = "sigma2";

    // create and setup plot
    Plot plot = new Plot("Sigma", "z [nm]", "sigma [px]", null, (float[]) null);
    plot.setSize(1024, 768);
    plot.setLimits(-2*zRange, +2*zRange, 0, stageStep);
    double[] xVals = new double[(int)(2*zRange/stageStep) * 2 + 1];
    for(int val = -2*(int)zRange, i = 0; val <= +2*(int)zRange; val += stageStep, i++) {
        xVals[i] = val;
    }
    plot.draw();

    // plot
    drawSigmaPlots(plot, xVals, cfg);

    // display
    plot.show();
}
 
Example 3
Source File: ResultsDriftCorrection.java    From thunderstorm with GNU General Public License v3.0 5 votes vote down vote up
public static void showDriftPlot(DriftResults driftCorrection) {
    int minFrame = driftCorrection.getMinFrame();
    int maxFrame = driftCorrection.getMaxFrame();
    int gridTicks = 200;
    double tickStep = (maxFrame - minFrame) / (double) gridTicks;
    double[] grid = new double[gridTicks];
    double[] driftX = new double[gridTicks];
    double[] driftY = new double[gridTicks];
    for(int i = 0; i < gridTicks; i++) {
        grid[i] = i * tickStep + minFrame;
        Point2D.Double offset = driftCorrection.getInterpolatedDrift(grid[i]);
        driftX[i] = offset.x;
        driftY[i] = offset.y;
    }
    Plot plot = new Plot("Drift", "frame", "drift [" + driftCorrection.getUnits() + "]", (float[]) null, null);
    if(driftCorrection.getDriftDataX().length > 50) {
        plot.setFrameSize(1280, 720);
    }
    plot.setLimits(minFrame, driftCorrection.getMaxFrame(),
            Math.min(VectorMath.min(driftCorrection.getDriftDataX()), VectorMath.min(driftCorrection.getDriftDataY())),
            Math.max(VectorMath.max(driftCorrection.getDriftDataX()), VectorMath.max(driftCorrection.getDriftDataY())));
    plot.setColor(new Color(255, 128, 128));
    plot.addPoints(driftCorrection.getDriftDataFrame(), driftCorrection.getDriftDataX(), Plot.CROSS);
    plot.draw();
    plot.setColor(new Color(128, 255, 128));
    plot.addPoints(driftCorrection.getDriftDataFrame(), driftCorrection.getDriftDataY(), Plot.CROSS);
    plot.setColor(Color.red);
    plot.addPoints(grid, driftX, Plot.LINE);
    plot.addLabel(0.05, 0.8, "x drift");
    plot.setColor(Color.green);
    plot.addPoints(grid, driftY, Plot.LINE);
    plot.addLabel(0.05, 0.9, "y drift");
    plot.show();
}
 
Example 4
Source File: AstigmaticBiplaneCalibrationProcess.java    From thunderstorm with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void drawSigmaPlots() {
    // config plane 1
    SigmaPlotConfig cfg1 = new SigmaPlotConfig();
    cfg1.allFrames = allFrames1;
    cfg1.allSigma1s = allSigma11s;
    cfg1.allSigma2s = allSigma12s;
    cfg1.allPolynomsS1 = allPolyS11;
    cfg1.allPolynomsS2 = allPolyS12;
    cfg1.polynomS1Final = polyS11;
    cfg1.polynomS2Final = polyS12;
    cfg1.allSigma1sColor = new Color(255, 200, 200);
    cfg1.allSigma2sColor = new Color(200, 200, 255);
    cfg1.allPolynomsS1Color = new Color(255, 230, 230);
    cfg1.allPolynomsS2Color = new Color(230, 230, 255);
    cfg1.polynomS1FinalColor = new Color(255, 0, 0);
    cfg1.polynomS2FinalColor = new Color(0, 0, 255);
    cfg1.legend1X = 0.1;
    cfg1.legend1Y = 0.8;
    cfg1.legend1Label = "sigma11";
    cfg1.legend2X = 0.1;
    cfg1.legend2Y = 0.9;
    cfg1.legend2Label = "sigma12";

    // config plane 2
    SigmaPlotConfig cfg2 = new SigmaPlotConfig();
    cfg2.allFrames = allFrames2;
    cfg2.allSigma1s = allSigma21s;
    cfg2.allSigma2s = allSigma22s;
    cfg2.allPolynomsS1 = allPolyS21;
    cfg2.allPolynomsS2 = allPolyS22;
    cfg2.polynomS1Final = polyS21;
    cfg2.polynomS2Final = polyS22;
    cfg2.allSigma1sColor = new Color(255, 200, 255);
    cfg2.allSigma2sColor = new Color(200, 255, 255);
    cfg2.allPolynomsS1Color = new Color(255, 230, 255);
    cfg2.allPolynomsS2Color = new Color(230, 255, 255);
    cfg2.polynomS1FinalColor = new Color(255, 0, 255);
    cfg2.polynomS2FinalColor = new Color(0, 255, 255);
    cfg2.legend1X = 0.2;
    cfg2.legend1Y = 0.8;
    cfg2.legend1Label = "sigma21";
    cfg2.legend2X = 0.2;
    cfg2.legend2Y = 0.9;
    cfg2.legend2Label = "sigma22";

    // create and setup plot
    Plot plot = new Plot("Sigma", "z [nm]", "sigma [px]", null, (float[]) null);
    plot.setSize(1024, 768);
    plot.setLimits(-2*zRange, +2*zRange, 0, stageStep);
    double[] xVals = new double[(int)(2*zRange/stageStep) * 2 + 1];
    for(int val = -2*(int)zRange, i = 0; val <= +2*(int)zRange; val += stageStep, i++) {
        xVals[i] = val;
    }
    plot.draw();

    // plot
    drawSigmaPlots(plot, xVals, cfg1);
    drawSigmaPlots(plot, xVals, cfg2);

    // display
    plot.show();
}