本文整理汇总了Java中ij.gui.Plot.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java Plot.setColor方法的具体用法?Java Plot.setColor怎么用?Java Plot.setColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.Plot
的用法示例。
在下文中一共展示了Plot.setColor方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: plotJaccard
import ij.gui.Plot; //导入方法依赖的package包/类
private void plotJaccard(ResidualsScore residualsScore, ResidualsScore residualsScoreReference)
{
String title = TITLE + " Score";
Plot plot = new Plot(title, "Residuals", "Score");
double max = getMax(0.01, residualsScore);
if (residualsScoreReference != null)
{
max = getMax(max, residualsScore);
}
plot.setLimits(0, 1, 0, max * 1.05);
addLines(plot, residualsScore, 1);
if (residualsScoreReference != null)
{
addLines(plot, residualsScoreReference, 0.5);
}
plot.setColor(Color.black);
plot.addLabel(0, 0,
String.format("Residuals %s; Jaccard %s (Black); Precision %s (Blue); Recall %s (Red)",
Utils.rounded(residualsScore.residuals[residualsScore.maxJaccardIndex]),
Utils.rounded(residualsScore.jaccard[residualsScore.maxJaccardIndex]),
Utils.rounded(residualsScore.precision[residualsScore.maxJaccardIndex]),
Utils.rounded(residualsScore.recall[residualsScore.maxJaccardIndex])));
display(title, plot);
}
示例3: 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);
}
}
示例4: 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;
}
示例5: 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);
}
示例6: 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();
}
示例7: 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();
}
示例8: 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);
}
}
示例9: showPairCorrelation
import ij.gui.Plot; //导入方法依赖的package包/类
private PlotWindow showPairCorrelation(PC pc)
{
double avDensity = (double) pc.n / pc.area;
String title = "Pair Correlation";
Plot plot2 = new Plot(TITLE + " " + title, "r (px)", "g(r)", pc.r, pc.pcf);
plot2.setColor(Color.red);
plot2.drawLine(pc.r[0], 1, pc.r[pc.r.length - 1], 1);
plot2.addLabel(0, 0, "Av.Density = " + IJ.d2s(avDensity, -3) + " px^-2");
plot2.setColor(Color.blue);
return Utils.display(TITLE + " " + title, plot2);
}
示例10: mouseClicked
import ij.gui.Plot; //导入方法依赖的package包/类
/**
* Performs the showing for a particular voxel,when this one is marked by
* the mouse
*/
public void mouseClicked(MouseEvent e) {
ip = IJ.getImage();
canvas = ip.getCanvas();
int offscreenX = canvas.offScreenX(e.getX());
int offscreenY = canvas.offScreenY(e.getY());
VoxelT2 v = VoxelT2.VoxelSearch(voxels, offscreenX, offscreenY,
ip.getSlice());
if (v != null) {
double[] x = new double[v.contrastRaw.length], y = new double[x.length];
for (int i = 0; i < x.length; i++)
x[i] = i;
y = v.contrastRaw;
Plot chart = new Plot("slice:" + ip.getSlice() + " x:"
+ offscreenX + " y:" + offscreenY, "Time", "Contrast", x,
y);
if (pw == null) {
pw = chart.show();
pw.addWindowListener(this);
} else
pw.setTitle("slice:" + ip.getSlice() + " x:" + offscreenX
+ " y:" + offscreenY);
chart.setColor(java.awt.Color.BLUE);
chart.addPoints(x, v.contrastFitted, PlotWindow.LINE);
chart.addLabel(0.75, 0.2, "� Fitted Contrast");
chart.setColor(java.awt.Color.BLACK);
chart.addLabel(0.75, 0.1, "� Raw Contrast");
pw.drawPlot(chart);
} else if (showMove.isSelected() == false)
IJ.showMessage("No meaningful contrast");
}
示例11: paintChart
import ij.gui.Plot; //导入方法依赖的package包/类
/**
* Displays the AIF calculated and its fitted version
*
*/
public void paintChart() {
double[] x = new double[AIF.length];
double contMax, contMin;
for (int i = 0; i < x.length; i++)
x[i] = i;
AIFChart = new Plot("AIF", "Time", "Contrast", x, AIF);
if (AIFfit != null) {
contMax = StatUtils.max(AIF) > StatUtils.max(AIFfit) ? StatUtils
.max(AIF) : StatUtils.max(AIFfit);
contMin = StatUtils.min(AIF) < StatUtils.min(AIFfit) ? StatUtils
.min(AIF) : StatUtils.min(AIFfit);
} else {
contMax = StatUtils.max(AIF);
contMin = StatUtils.min(AIF);
}
AIFChart.setLimits(StatUtils.min(x), StatUtils.max(x), contMin, contMax);
if (AIFfit != null) {
AIFChart.addPoints(x, AIFfit, Plot.LINE);
AIFChart.setColor(java.awt.Color.RED);
}
if (AIFWindow != null)
AIFWindow.close();
AIFWindow = AIFChart.show();
}
示例12: 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);
}
示例13: 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();
}
示例14: 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();
}