本文整理汇总了Java中ij.gui.Plot.draw方法的典型用法代码示例。如果您正苦于以下问题:Java Plot.draw方法的具体用法?Java Plot.draw怎么用?Java Plot.draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.Plot
的用法示例。
在下文中一共展示了Plot.draw方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showPlot
import ij.gui.Plot; //导入方法依赖的package包/类
/**
* Display a graph showing connectivity vs. threshold
*
* @param testThreshold
* @param conns
*/
private void showPlot(final double[] testThreshold, final double[] conns) {
// convert arrays to floats
final int nPoints = testThreshold.length;
final float[] xData = new float[nPoints];
final float[] yData = new float[nPoints];
double xMin = Double.MAX_VALUE;
double xMax = Double.MIN_VALUE;
double yMax = Double.MIN_VALUE;
for (int i = 0; i < nPoints; i++) {
xData[i] = (float) testThreshold[i];
yData[i] = (float) conns[i];
xMin = Math.min(xMin, xData[i]);
xMax = Math.max(xMax, xData[i]);
yMax = Math.max(yMax, yData[i]);
}
final Plot plot = new Plot("Connectivity vs. Threshold", "Threshold", "Connectivity", xData, yData);
plot.addPoints(xData, yData, Plot.CIRCLE);
plot.setLimits(xMin, xMax, 0, yMax);
plot.draw();
final ImageProcessor plotIp = plot.getProcessor();
final ImagePlus plotImage = new ImagePlus();
plotImage.setProcessor("Connectivity vs. Threshold", plotIp);
plotImage.show();
}
示例2: drawSigmaPlots
import ij.gui.Plot; //导入方法依赖的package包/类
@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();
}
示例3: showDriftPlot
import ij.gui.Plot; //导入方法依赖的package包/类
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();
}
示例4: showModel
import ij.gui.Plot; //导入方法依赖的package包/类
protected static void showModel(FuzzySobelModel model) {
double bins[] = new double[256];
for (int i = 0; i < bins.length; i++) {
bins[i] = i;
}
Plot plot = new Plot("Fuzzy edge model", "Pixel magnitude", "Membership", bins, model.getMuSmoot());
plot.setColor(Color.RED);
plot.addPoints(bins, model.getMuEdge(), Plot.LINE);
plot.setColor(Color.BLUE);
plot.addLegend("Smooth\nEdge");
plot.setLimits(0.0, 255.0, 0.0, 1.0);
plot.draw();
plot.show();
}
示例5: drawSigmaPlots
import ij.gui.Plot; //导入方法依赖的package包/类
@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();
}
示例6: createPlot
import ij.gui.Plot; //导入方法依赖的package包/类
private void createPlot()
{
double[] xValues = createHistogramAxis(histogramX);
double[] yValues = createHistogramValues(normalisedHistogram);
// Set the upper limit for the plot
double maxHistogram = 0;
for (double d : normalisedHistogram)
if (maxHistogram < d)
maxHistogram = d;
maxHistogram *= 1.05;
plot = new Plot(plotTitle, plotXTitle, plotYTitle, xValues, yValues, Plot.X_NUMBERS + Plot.Y_NUMBERS +
Plot.X_TICKS + Plot.Y_TICKS);
// Ensure the horizontal scale goes from 0 to 1 but add at least 0.05 to the limits.
double xMin = Math.min(xValues[0] - 0.05, Math.min(sampleValue - 0.05, 0));
double xMax = Math.max(xValues[xValues.length - 1] + 0.05, Math.max(sampleValue + 0.05, 1));
plot.setLimits(xMin, xMax, 0, maxHistogram * 1.05);
plot.setLineWidth(1);
plot.setColor(color);
plot.draw();
// Draw the significance lines and add top points
plot.drawLine(probabilityLimits[0], 0, probabilityLimits[0], maxHistogram);
plot.drawLine(probabilityLimits[1], 0, probabilityLimits[1], maxHistogram);
// Draw lines for the lower and upper probability limits
double[][] markers = new double[2][2];
markers[0][0] = probabilityLimits[0];
markers[0][1] = probabilityLimits[1];
markers[1][0] = maxHistogram;
markers[1][1] = maxHistogram;
plot.addPoints(markers[0], markers[1], 4);
// Draw line for the data value
double[][] valueMarker = new double[2][1];
valueMarker[0][0] = sampleValue;
valueMarker[1][0] = maxHistogram;
plot.setColor(Color.magenta);
plot.drawLine(sampleValue, 0, sampleValue, maxHistogram);
plot.addPoints(valueMarker[0], valueMarker[1], 0);
}
示例7: plotResults
import ij.gui.Plot; //导入方法依赖的package包/类
private void plotResults(ArrayList<ColocalisationThreshold.ThresholdResult> results)
{
if (results == null)
return;
double[] threshold = new double[results.size()];
double[] R = new double[results.size()];
double[] R2 = new double[results.size()];
double yMin = 1, yMax = -1;
// Plot the zero threshold result at the minimum threshold value
int minThreshold = Integer.MAX_VALUE;
int zeroThresholdIndex = 0;
for (int i = 0, j = results.size() - 1; i < results.size(); i++, j--)
{
ColocalisationThreshold.ThresholdResult result = results.get(i);
threshold[j] = result.threshold1;
R[j] = result.r;
R2[j] = result.r2;
if (yMin > R[j])
yMin = R[j];
if (yMin > R2[j])
yMin = R2[j];
if (yMax < R[j])
yMax = R[j];
if (yMax < R2[j])
yMax = R2[j];
if (result.threshold1 == 0)
{
zeroThresholdIndex = j;
}
else if (minThreshold > result.threshold1)
{
minThreshold = result.threshold1;
}
}
threshold[zeroThresholdIndex] = (minThreshold > 0) ? minThreshold - 1 : 0;
if (rPlot != null && rPlot.isVisible())
rPlot.close();
Plot plot = new Plot(correlationValuesTitle, "Threshold", "R", threshold, R);
plot.setLimits(threshold[0], threshold[threshold.length - 1], yMin, yMax);
plot.setColor(Color.BLUE);
plot.draw();
plot.setColor(Color.RED);
plot.addPoints(threshold, R2, Plot.CROSS);
plot.setColor(Color.BLACK);
plot.addLabel(0, 0, "Blue=C1+C2 above threshold; Red=Ch1/Ch2 below threshold");
rPlot = plot.show();
}
示例8: showHistogram
import ij.gui.Plot; //导入方法依赖的package包/类
private void showHistogram(float[] h, int[] thresholds, int minbin, String title)
{
int NGRAY = h.length;
// X-axis values
float[] bin = new float[NGRAY];
// Calculate the maximum
float hmax = 0.f;
int mode = 0;
for (int i = 0; i < NGRAY; ++i)
{
bin[i] = i + minbin;
if (hmax < h[i])
{
hmax = h[i];
mode = i;
}
}
// Clip histogram to exclude the mode count as per the ij.gui.HistogramWindow.
// For example this removes a large peak at zero in masked images.
float hmax2 = 0; // Second highest point
for (int i = 0; i < h.length; i++)
{
if (hmax2 < h[i] && i != mode)
{
hmax2 = h[i];
}
}
if ((hmax > (hmax2 * 2)) && (hmax2 != 0))
{
// Set histogram limit to 50% higher than the second largest value
hmax = hmax2 * 1.5f;
}
if (title == null)
title = "Histogram";
Plot histogram = new Plot(title, "Intensity", "p(Intensity)", bin, h);
histogram.setLimits(minbin, minbin + NGRAY, 0.f, hmax);
histogram.draw();
// Add lines for each threshold
histogram.setLineWidth(1);
histogram.setColor(Color.red);
for (int i=1; i<thresholds.length; i++)
{
double x = thresholds[i];
histogram.drawLine(x, 0, x, hmax);
}
histogram.show();
}