本文整理汇总了Java中ij.gui.Plot.addPoints方法的典型用法代码示例。如果您正苦于以下问题:Java Plot.addPoints方法的具体用法?Java Plot.addPoints怎么用?Java Plot.addPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.Plot
的用法示例。
在下文中一共展示了Plot.addPoints方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawFlinnPlot
import ij.gui.Plot; //导入方法依赖的package包/类
/**
* Display each ellipsoid's axis ratios in a scatter plot
*
* @param title
* @param ellipsoids
* @return
*/
private ImagePlus drawFlinnPlot(final String title, final Ellipsoid[] ellipsoids) {
final int l = ellipsoids.length;
final double[] aOverB = new double[l];
final double[] bOverC = new double[l];
for (int i = 0; i < l; i++) {
final double[] radii = ellipsoids[i].getSortedRadii();
aOverB[i] = radii[0] / radii[1];
bOverC[i] = radii[1] / radii[2];
}
final Plot plot = new Plot("Flinn Diagram of " + title, "b/c", "a/b");
plot.setLimits(0, 1, 0, 1);
plot.setSize(1024, 1024);
plot.addPoints(bOverC, aOverB, Plot.CIRCLE);
final ImageProcessor plotIp = plot.getProcessor();
final ImagePlus plotImage = new ImagePlus("Flinn Diagram of " + title, plotIp);
return plotImage;
}
示例2: 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();
}
示例3: createScatterPlot
import ij.gui.Plot; //导入方法依赖的package包/类
public static Plot createScatterPlot(String title, double [] xCoords, double [] yCoords, Function func){
double margin = 0.15;
int scale = 200;
func.fitToPoints(xCoords, yCoords);
float [] xVals = new float[scale];
float [] yVals = new float[scale];
double [] stats = DoubleArrayUtil.minAndMaxOfArray(xCoords);
double range = (stats[1] - stats[0]) * (1+(2*margin));
for (int i=0;i<scale;i++){
double x = stats[0] - (range * margin) + ((i + 0.0) / scale) * range;
xVals[i] = (float) x;
yVals[i] = (float) func.evaluate(x);
}
double avg = 0;
for (int i=0;i<xCoords.length;i++){
double other = func.evaluate(xCoords[i]);
avg += Math.pow(other - yCoords[i],2);
}
avg /= xCoords.length;
avg = Math.sqrt(avg);
Plot plot = new Plot(title + " (r = "+DoubleArrayUtil.correlateDoubleArrays(xCoords, yCoords)+" SSIM: " + DoubleArrayUtil.computeSSIMDoubleArrays(xCoords, yCoords) + ") Model: " + func.toString() + " standard deviation along model: " + avg, "X", "Y", xVals, yVals, Plot.DEFAULT_FLAGS);
plot.addPoints(xCoords, yCoords, Plot.CIRCLE);
return plot;
}
示例4: addPoints
import ij.gui.Plot; //导入方法依赖的package包/类
private void addPoints(Plot plot, int shape, double[] x, double[] y, double lower, double upper, Color color)
{
double[] x2 = new double[x.length];
double[] y2 = new double[y.length];
int c = 0;
for (int i = 0; i < x.length; i++)
{
if (x[i] >= lower && x[i] <= upper)
{
x2[c] = x[i];
y2[c] = y[i];
c++;
}
}
if (c == 0)
return;
x2 = Arrays.copyOf(x2, c);
y2 = Arrays.copyOf(y2, c);
plot.setColor(color);
plot.addPoints(x2, y2, shape);
}
示例5: addLines
import ij.gui.Plot; //导入方法依赖的package包/类
private void addLines(Plot plot, ResidualsScore residualsScore, double saturation)
{
if (saturation == 1)
{
// Colours are the same as the BenchmarkSpotFilter
plot.setColor(Color.black);
plot.addPoints(residualsScore.residuals, residualsScore.jaccard, Plot.LINE);
plot.setColor(Color.blue);
plot.addPoints(residualsScore.residuals, residualsScore.precision, Plot.LINE);
plot.setColor(Color.red);
plot.addPoints(residualsScore.residuals, residualsScore.recall, Plot.LINE);
}
else
{
plot.setColor(getColor(Color.black, saturation));
plot.addPoints(residualsScore.residuals, residualsScore.jaccard, Plot.LINE);
plot.setColor(getColor(Color.blue, saturation));
plot.addPoints(residualsScore.residuals, residualsScore.precision, Plot.LINE);
plot.setColor(getColor(Color.red, saturation));
plot.addPoints(residualsScore.residuals, residualsScore.recall, Plot.LINE);
}
}
示例6: addNonFittedPoints
import ij.gui.Plot; //导入方法依赖的package包/类
private void addNonFittedPoints(Plot plot, double[][] gr, BaseModelFunction model, double[] parameters)
{
double[] x = new double[gr[0].length];
double[] y = new double[x.length];
int j = 0;
for (int i = offset; i < gr[0].length; i++)
{
// Output points that were not fitted
if (gr[0][i] < randomModel.getX()[0])
{
x[j] = gr[0][i];
y[j] = model.evaluate(gr[0][i], parameters);
j++;
}
}
x = Arrays.copyOf(x, j);
y = Arrays.copyOf(y, j);
plot.addPoints(x, y, Plot.CIRCLE);
}
示例7: createPlot
import ij.gui.Plot; //导入方法依赖的package包/类
private Plot createPlot(double[] distances, double[] values, Color color, Color avColor, String title,
String xLabel, String yLabel, double[] spacedX, double[] ceroValuesX, double[] ceroValuesY, double[] spacedY)
{
float[] dummy = null;
Plot plot = new Plot(title, xLabel.concat(pixelsUnitString), yLabel, dummy, dummy, Plot.X_NUMBERS +
Plot.Y_NUMBERS + Plot.X_TICKS + Plot.Y_TICKS);
double min = 0;
for (double d : values)
{
if (min > d)
min = d;
}
plot.setLimits(0.0D, maximumRadius, min, 1.0D);
plot.setColor(color);
plot.addPoints(distances, values, Plot.X);
addAverage(plot, distances, values, avColor);
plot.setColor(Color.black);
plot.addPoints(spacedX, ceroValuesX, 5);
plot.addPoints(ceroValuesY, spacedY, 5);
return plot;
}
示例8: updateGraph
import ij.gui.Plot; //导入方法依赖的package包/类
/**
* Draw on plotImage the data in anisotropyHistory with error bars from
* errorHistory
*
* @param plotImage
* the graph image
* @param anisotropyHistory
* all anisotropy results, 1 for each iteration
* @param errorHistory
* all error results, 1 for each iteration
*/
private void updateGraph(final ImagePlus plotImage, final Vector<Double> anisotropyHistory,
final Vector<Double> errorHistory) {
final double[] yVariables = new double[anisotropyHistory.size()];
final double[] xVariables = new double[anisotropyHistory.size()];
final Enumeration<Double> e = anisotropyHistory.elements();
int i = 0;
while (e.hasMoreElements()) {
yVariables[i] = e.nextElement();
xVariables[i] = i;
i++;
}
final Enumeration<Double> f = errorHistory.elements();
i = 0;
final double[] errorBars = new double[errorHistory.size()];
while (f.hasMoreElements()) {
errorBars[i] = f.nextElement();
i++;
}
final Plot plot = new Plot("Anisotropy", "Number of repeats", "Anisotropy", xVariables, yVariables);
plot.addPoints(xVariables, yVariables, Plot.X);
plot.addErrorBars(errorBars);
plot.setLimits(0, anisotropyHistory.size(), 0, 1);
final ImageProcessor plotIp = plot.getProcessor();
plotImage.setProcessor(null, plotIp);
return;
}
示例9: drawSigmaPlots
import ij.gui.Plot; //导入方法依赖的package包/类
protected static void drawSigmaPlots(Plot plot, double[] xVals, SigmaPlotConfig cfg) {
// add points
plot.setColor(cfg.allSigma1sColor);
plot.addPoints(cfg.allFrames, cfg.allSigma1s, Plot.CROSS);
plot.setColor(cfg.allSigma2sColor);
plot.addPoints(cfg.allFrames, cfg.allSigma2s, Plot.CROSS);
// add polynomials
for(int i = 0; i < cfg.allPolynomsS1.size(); i++) {
double[] sigma1Vals = new double[xVals.length];
double[] sigma2Vals = new double[xVals.length];
for(int j = 0; j < sigma1Vals.length; j++) {
sigma1Vals[j] = cfg.allPolynomsS1.get(i).value(xVals[j]);
sigma2Vals[j] = cfg.allPolynomsS2.get(i).value(xVals[j]);
}
plot.setColor(cfg.allPolynomsS1Color);
plot.addPoints(xVals, sigma1Vals, Plot.LINE);
plot.setColor(cfg.allPolynomsS2Color);
plot.addPoints(xVals, sigma2Vals, Plot.LINE);
}
// add final fitted curves
double[] sigma1ValsAll = new double[xVals.length];
double[] sigma2ValsAll = new double[xVals.length];
for(int j = 0; j < sigma1ValsAll.length; j++) {
sigma1ValsAll[j] = cfg.polynomS1Final.value(xVals[j]);
sigma2ValsAll[j] = cfg.polynomS2Final.value(xVals[j]);
}
plot.setColor(cfg.polynomS1FinalColor);
plot.addPoints(xVals, sigma1ValsAll, Plot.LINE);
plot.setColor(cfg.polynomS2FinalColor);
plot.addPoints(xVals, sigma2ValsAll, Plot.LINE);
//legend
plot.setColor(cfg.polynomS1FinalColor);
plot.addLabel(cfg.legend1X, cfg.legend1Y, cfg.legend1Label);
plot.setColor(cfg.polynomS2FinalColor);
plot.addLabel(cfg.legend2X, cfg.legend2Y, cfg.legend2Label);
}
示例10: 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();
}
示例11: 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();
}
示例12: main
import ij.gui.Plot; //导入方法依赖的package包/类
public static void main(String[] args){
// Define Point Cloud
SimpleMatrix p_k = new SimpleMatrix(4,2);
SimpleMatrix q_k = new SimpleMatrix(4,2);
p_k.setRowValue(0, new SimpleVector(1,2));
p_k.setRowValue(1, new SimpleVector(3,6));
p_k.setRowValue(2, new SimpleVector(4,6));
p_k.setRowValue(3, new SimpleVector(3,4));
q_k.setRowValue(0, new SimpleVector(-0.7, 2.1));
q_k.setRowValue(1, new SimpleVector(-2.1, 6.4));
q_k.setRowValue(2, new SimpleVector(-1.4, 7.1));
q_k.setRowValue(3, new SimpleVector(-0.7, 4.9));
// Plot Point Cloud
Plot plot = new Plot("Regression Line", "X", "Y", Plot.DEFAULT_FLAGS);
plot.setLimits(-10, 10, -10, 10);
plot.addPoints(p_k.getCol(0).copyAsDoubleArray(), p_k.getCol(1).copyAsDoubleArray(), Plot.BOX);
plot.addPoints(q_k.getCol(0).copyAsDoubleArray(), q_k.getCol(1).copyAsDoubleArray(), Plot.CIRCLE);
// Calculate registration parameter
Registration1 reg = new Registration1();
SimpleVector parameter = reg.registrationUsingPointCorrespondences(p_k, q_k);
// Rotation and translation
double phi = parameter.getElement(0);
SimpleVector translation = new SimpleVector(parameter.getElement(1), parameter.getElement(2));
// Transform points
SimpleMatrix transformedPoints = reg.applyTransform(q_k, phi, translation);
// Add transformed point cloud to the plot
plot.addPoints(transformedPoints.getCol(0).copyAsDoubleArray(), transformedPoints.getCol(1).copyAsDoubleArray(), Plot.CROSS);
plot.show();
}
示例13: display
import ij.gui.Plot; //导入方法依赖的package包/类
private void display(WindowOrganiser wo, String string, float[] x, float[] y, boolean fixedXAxis)
{
String title = TITLE + " " + string;
Plot plot = new Plot(title, "Candidate", string);
double maxx = (fixedXAxis) ? maxSize : x[x.length - 1];
double maxy = Maths.max(y);
plot.setLimits(x[0], maxx, 0, maxy * 1.05);
plot.addPoints(x, y, Plot.LINE);
plot.addLabel(0, 0, "Max = " + maxy);
Utils.display(title, plot, 0, wo);
}
示例14: draw
import ij.gui.Plot; //导入方法依赖的package包/类
private void draw(WindowOrganiser wo)
{
_msdThreshold = dThreshold;
_normalise = normalise;
// Find the index in the MSD array
int index = Arrays.binarySearch(d, _msdThreshold);
if (index < 0)
index = -index - 1;
_index = index;
// Histogram the distributions
computeHistogram(0, index, length, h1);
computeHistogram(index, length.length, length, h2);
int sum1 = (int) Maths.sum(h1);
int sum2 = (int) Maths.sum(h2);
float max1 = createHistogramValues(h1, (_normalise) ? sum1 : 1, y1);
float max2 = createHistogramValues(h2, (_normalise) ? sum2 : 2, y2);
String title = "Trace length distribution";
Plot plot = new Plot(title, "Length", "Frequency");
plot.setLimits(minX, maxX, 0, Math.max(max1, max2) * 1.05);
plot.setColor(Color.red);
plot.addPoints(x1, y1, Plot.LINE);
plot.setColor(Color.blue);
plot.addPoints(x2, y2, Plot.LINE);
plot.setColor(Color.black);
double p = 100.0 * sum1 / (sum1 + sum2);
plot.addLabel(0, 0, String.format("Fixed (red) = %d (%s%%), Moving (blue) = %d (%s%%)", sum1, Utils.rounded(p),
sum2, Utils.rounded(100 - p)));
PlotWindow pw = Utils.display(title, plot, Utils.NO_TO_FRONT);
if (wo != null)
{
// First call with the window organiser put at the front
pw.toFront();
if (Utils.isNewWindow())
wo.add(pw);
}
}
示例15: mouseClicked
import ij.gui.Plot; //导入方法依赖的package包/类
/**
* Does the actual plotting.
*/
@Override
public void mouseClicked(MouseEvent e) {
int offscreenX = canvas.offScreenX(e.getX());
int offscreenY = canvas.offScreenY(e.getY());
double[] y = getTAC(offscreenX, offscreenY, imp.getSlice());
if (y != null) {
// Fill in X axis (frame number)
double[] x = new double[dim[4]];
for (int i = 1; i <= x.length; i++)
x[i - 1] = i;
// Fill in Y axis (image intensity)
if (invert)
for (int i = 0; i < y.length; i++)
y[i] = -y[i];
// Prepare plot window
Plot chart = new Plot("Slice = " + imp.getSlice() + ", x = "
+ offscreenX + ", y = " + offscreenY,
"Frame number", "Intensity (calibrated)", x, y);
if (pw == null) {
pw = chart.show();
pw.addWindowListener(this);
} else
pw.setTitle("Slice = " + imp.getSlice() + ", x = " + offscreenX
+ ", y = " + offscreenY);
// Add the points for prettier plots
chart.addPoints(x, y, PlotWindow.CIRCLE);
pw.drawPlot(chart);
}
}