• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Plot类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Plot类属于ij.gui包,在下文中一共展示了Plot类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


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


示例17: showLineProfile

import ij.gui.Plot; //导入依赖的package包/类
/**
 * Show a plot of the line profile
 * 
 * @param xValues
 * @param yValues
 * @param profileTitle
 */
private void showLineProfile(float[] xValues, float[] yValues, String profileTitle)
{
	if (showLineProfiles)
	{
		Frame f = WindowManager.getFrame(profileTitle);
		Plot plot = new Plot(profileTitle, "Distance", "Value", xValues, yValues);
		if (f instanceof PlotWindow)
		{
			PlotWindow p = ((PlotWindow) f);
			p.drawPlot(plot);
		}
		else
		{
			plot.show();
		}

		plotProfiles.add(profileTitle);
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:27,代码来源:SpotSeparation.java


示例18: makePlot

import ij.gui.Plot; //导入依赖的package包/类
static public Plot makePlot(final CATAParameters cp, final String name, final VectorString3D c) {
	final double[] stdDev = c.getStdDevAtEachPoint();
	if (null == stdDev) return null;
	final double[] index = new double[stdDev.length];
	for (int i=0; i<index.length; i++) index[i] = i;
	Utils.log2("name is " + name);
	Utils.log2("c is " + c);
	Utils.log2("cp is " + cp);
	Utils.log2("stdDev is " + stdDev);
	Utils.log2("c.getCalibrationCopy() is " + c.getCalibrationCopy());
	Utils.log2("c.getDelta() is " + c.getDelta());
	final Calibration cal = c.getCalibrationCopy();
	if (null == cal) Utils.log2("WARNING null calibration!");
	final Plot plot = new Plot(name, name + " -- Point index (delta: " + Utils.cutNumber(c.getDelta(), 2) + " " + (null == cal ? "pixels" : cal.getUnits()) + ")", "Std Dev", index, stdDev);
	plot.setLimits(0, cp.plot_max_x, 0, cp.plot_max_y);
	plot.setSize(cp.plot_width, cp.plot_height);
	plot.setLineWidth(2);
	return plot;
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:20,代码来源:Compare.java


示例19: createGraph

import ij.gui.Plot; //导入依赖的package包/类
/**
 * Create a graph for plotting anisotropy results
 *
 * @param id
 *            Identification string for Anisotropy plot
 * @return ImagePlus for drawing a plot on
 */
private ImagePlus createGraph(final String id) {
	final double[] x = { 0 }, y = { 0 };
	final Plot plot = new Plot("Anisotropy", "Repeats", "Anisotropy", x, y);
	plot.setLimits(0, 1, 0, 1);
	final ImageProcessor plotIp = plot.getProcessor();
	final ImagePlus plotImage = new ImagePlus("Anisotropy of " + id, plotIp);
	plotImage.setProcessor(null, plotIp);
	return plotImage;
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:17,代码来源:Anisotropy.java


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CtMethod类代码示例发布时间:2022-05-22
下一篇:
Java UserQueryImpl类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap