当前位置: 首页>>代码示例>>Java>>正文


Java Plot类代码示例

本文整理汇总了Java中ij.gui.Plot的典型用法代码示例。如果您正苦于以下问题:Java Plot类的具体用法?Java Plot怎么用?Java Plot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Plot类属于ij.gui包,在下文中一共展示了Plot类的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;
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:28,代码来源:EllipsoidFactor.java

示例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();
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:31,代码来源:ThresholdMinConn.java

示例3: createPlot

import ij.gui.Plot; //导入依赖的package包/类
public static Plot createPlot(double [] yValues, String title, String xLabel, String yLabel){
	double [] xValues = new double [yValues.length];
	double min = Double.MAX_VALUE;
	double max = -Double.MAX_VALUE;
	for (int i = 0; i < xValues.length; i ++){
		min = (yValues[i] < min) ? yValues[i] : min;
		max = (yValues[i] > max) ? yValues[i] : max;
		xValues[i] = i + 1;
	}
	if (min == max){
		max++;
	}
	Plot plot = new Plot(title, xLabel, yLabel, xValues, yValues, Plot.DEFAULT_FLAGS);
	plot.setLimits(1, xValues.length, min, max);
	return plot;
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:17,代码来源:VisualizationUtil.java

示例4: 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;
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:26,代码来源:VisualizationUtil.java

示例5: evaluate

import ij.gui.Plot; //导入依赖的package包/类
@Override
public Object evaluate() {
	if (configured) {
		if (roi instanceof Line){
			Line line = (Line) roi;
			double [] pixels = line.getPixels();
			//VisualizationUtil.createPlot("Edge", edge).show();
			double [] fft = FFTUtil.fft(pixels);
			Plot plot = VisualizationUtil.createHalfComplexPowerPlot(fft, "Edge MTF of " + image.getTitle());
			try {
				plot.show();
			} catch (Exception e){
				System.out.println(plot.toString());
			}
		}
	}
	return null;
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:19,代码来源:MeasurePatternMTF.java

示例6: run

import ij.gui.Plot; //导入依赖的package包/类
@Override
public void run(String arg) {
	try {
		double min = UserUtil.queryDouble("Minimum [keV]", 10);
		double max = UserUtil.queryDouble("Maximum [keV]", 150);
		double delta = UserUtil.queryDouble("Delta [keV]", 0.5);
		Material material = UserUtil.queryMaterial("Please Select the Material:", "Material Selection");
		LinearInterpolatingDoubleArray lut = EnergyDependentCoefficients.getPhotonMassAttenuationLUT(material);
		int steps = (int) ((max - min) / delta);
		double [] energies = new double [steps];
		double [] coefficients = new double[energies.length];
		for (int i = 0; i < steps; i ++){
			energies[i] = min + (i*delta);
			coefficients[i] = (lut.getValue(energies[i] / 1000));
		}
		//DoubleArrayUtil.log(spectrum);
		Plot plot = new Plot(material + " photon mass attenuation coefficient", "Energy", "ln (coefficient)", energies, coefficients);
		plot.show();
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:24,代码来源:Generate_Photon_Mass_Attenuation_Plot.java

示例7: run

import ij.gui.Plot; //导入依赖的package包/类
@Override
public void run(String arg) {
	try {
		double min = UserUtil.queryDouble("Minimum [keV]", 10);
		double max = UserUtil.queryDouble("Maximum [keV]", 150);
		double delta = UserUtil.queryDouble("Delta [keV]", 0.5);
		Object materialString = UserUtil.chooseObject("Please select a material: ", "Material Selection", MaterialsDB.getMaterials(), "water");
		Material material = MaterialsDB.getMaterial(materialString.toString());
		
		int steps = (int) ((max - min) / delta);
		double [] energies = new double [steps];
		double [] absorption =  new double [steps];
		
		for (int i = 0; i < steps; i ++){
			energies[i] = min + (i*delta);
			absorption[i] = material.getAttenuation(energies[i], AttenuationType.TOTAL_WITH_COHERENT_ATTENUATION) / material.getDensity();
		}
		
		Plot plot = new Plot("Absorption Spectrum of " + material, "Energy [keV]", "mu / rho [cm^2/g]", energies, absorption);
		plot.show();
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:26,代码来源:Generate_Absorption_Plot.java

示例8: createPlot

import ij.gui.Plot; //导入依赖的package包/类
public static Plot createPlot(double [] xValues, double [] yValues, String title, String xLabel, String yLabel){
	double miny = Double.MAX_VALUE;
	double maxy = -Double.MAX_VALUE;
	double minx = Double.MAX_VALUE;
	double maxx = -Double.MAX_VALUE;
	for (int i = 0; i < xValues.length; i ++){
		miny = (yValues[i] < miny) ? yValues[i] : miny;
		maxy = (yValues[i] > maxy) ? yValues[i] : maxy;
		minx = (xValues[i] < minx) ? xValues[i] : minx;
		maxx = (xValues[i] > maxx) ? xValues[i] : maxx;

	}
	if (miny == maxy){
		maxy++;
	}
	if (minx == maxx){
		maxx++;
	}
	Plot plot = new Plot(title, xLabel, yLabel, xValues, yValues, Plot.DEFAULT_FLAGS);
	plot.setLimits(minx, maxx, miny, maxy);
	return plot;
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:23,代码来源:Measure_MTF_Wire.java

示例9: 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);
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:22,代码来源:PSFDrift.java

示例10: update

import ij.gui.Plot; //导入依赖的package包/类
private void update()
{
	double fwhm = getFWHM();
	label.setText(String.format("FWHM = %s px (%s nm)", Utils.rounded(fwhm), Utils.rounded(fwhm * scale)));

	Plot plot = pw.getPlot();

	double x = plot.scaleXtoPxl(centre);
	double min = plot.scaleYtoPxl(0);
	double max = plot.scaleYtoPxl(maxY);

	pw.getImagePlus().setRoi(new Line(x, min, x, max));

	imp.setSlice(centre);
	imp.resetDisplayRange();
	imp.updateAndDraw();
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:18,代码来源:PSFDrift.java

示例11: showHistogram

import ij.gui.Plot; //导入依赖的package包/类
private void showHistogram(String name, double[] values, int bins, Statistics stats, WindowOrganiser wo)
{
	DoubleData data = new StoredData(values, false);
	double minWidth = 0;
	int removeOutliers = 0;
	int shape = Plot.CIRCLE; // Plot2.BAR; // A bar chart confuses the log plot since it plots lines to zero.
	String label = String.format("Mean = %s +/- %s", Utils.rounded(stats.getMean()),
			Utils.rounded(stats.getStandardDeviation()));
	int id = Utils.showHistogram(TITLE, data, name, minWidth, removeOutliers, bins, shape, label);
	if (Utils.isNewWindow())
		wo.add(id);
	// Redraw using a log scale. This requires a non-zero y-min
	Plot plot = Utils.plot;
	double[] limits = plot.getLimits();
	plot.setLimits(limits[0], limits[1], 1, limits[3]);
	plot.setAxisYLog(true);
	Utils.plot.updateImage();
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:19,代码来源:CMOSAnalysis.java

示例12: 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);
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:25,代码来源:DoubletAnalysis.java

示例13: 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);
	}
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:24,代码来源:DoubletAnalysis.java

示例14: 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);
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:20,代码来源:PCPALMFitting.java

示例15: refreshPlotWindow

import ij.gui.Plot; //导入依赖的package包/类
private PlotWindow refreshPlotWindow(PlotWindow plotWindow, boolean showPlotWindow, Plot plot, String locationKey)
{
	if (showPlotWindow && plot != null)
	{
		if (plotWindow != null && !plotWindow.isClosed())
		{
			plotWindow.drawPlot(plot);
		}
		else
		{
			plotWindow = plot.show();
			// Restore location from preferences
			restoreLocation(plotWindow, Prefs.getLocation(locationKey));
		}
	}
	else
	{
		closePlotWindow(plotWindow, locationKey);
		plotWindow = null;
	}

	return plotWindow;
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:24,代码来源:CDA_Plugin.java


注:本文中的ij.gui.Plot类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。