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

The following examples show how to use ij.gui.Plot#show() . 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: Lab.java    From DeconvolutionLab2 with GNU General Public License v3.0 6 votes vote down vote up
public static void plotProfile(RealSignal signal, String name, int x1, int y1, int z1, int x2, int y2, int z2) {
	if (signal == null) {
		return;
	}
	double dx = x2 - x1;
	double dy = y2 - y1;
	double dz = z2 - z1;
	double len = Math.sqrt(dx * dx + dy * dy + dz * dz);
	int n = (int) Math.round(len * 2);
	double ds = len / n;
	dx = (double) (x2 - x1) / n;
	dy = (double) (y2 - y1) / n;
	dz = (double) (z2 - z1) / n;
	double value[] = new double[n];
	double dist[] = new double[n];
	for (int s = 0; s < n; s++) {
		double x = x1 + s * dx;
		double y = y1 + s * dy;
		double z = z1 + s * dz;
		dist[s] = s * ds;
		value[s] = signal.getInterpolatedPixel(x, y, z);
	}
	Plot plot = new Plot(name, "distance", "intensity", dist, value);
	plot.show();
}
 
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();
}