本文整理汇总了Java中ij.gui.Plot.show方法的典型用法代码示例。如果您正苦于以下问题:Java Plot.show方法的具体用法?Java Plot.show怎么用?Java Plot.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.Plot
的用法示例。
在下文中一共展示了Plot.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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();
}
}
示例3: 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();
}
}
示例4: 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;
}
示例5: 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);
}
}
示例6: 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();
}
示例7: 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();
}
示例8: 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();
}
示例9: 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();
}
示例10: evaluate
import ij.gui.Plot; //导入方法依赖的package包/类
@Override
public Object evaluate() {
if (configured) {
if (roi instanceof Line){
Line line = (Line) roi;
SimpleVector normal = new SimpleVector(line.y2-line.y1,line.x2-line.x1);
normal.normalizeL2();
normal.multiplyBy(offset);
SimpleVector step = normal.clone();
step.multiplyBy(1/50.0);
double [] fftAll = null;
for (int i = 0; i < 100; i++){
Line newLine = new Line(line.x1-normal.getElement(0)+i*step.getElement(0), line.y1-normal.getElement(1)+i*step.getElement(1), line.x2-normal.getElement(0)+i*step.getElement(0), line.y2-normal.getElement(1)+i*step.getElement(1));
newLine.setImage(image);
double [] pixels = newLine.getPixels();
//VisualizationUtil.createPlot("Line", pixels).show();
double [] kernel = {-1, 0, 1};
double [] edge = DoubleArrayUtil.convolve(pixels, kernel);
//VisualizationUtil.createPlot("Edge", edge).show();
double [] fft = FFTUtil.fft(edge);
if (fftAll==null){
fftAll = fft;
} else {
DoubleArrayUtil.add(fftAll, fft);
}
}
DoubleArrayUtil.divide(fftAll, 100);
Plot plot = VisualizationUtil.createHalfComplexPowerPlot(fftAll, "Edge MTF of " + image.getTitle());
try {
plot.show();
} catch (Exception e){
System.out.println(plot.toString());
}
}
}
return null;
}
示例11: 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);
double angle = UserUtil.queryDouble("Angle [deg]", 12);
double peakVoltage = UserUtil.queryDouble("Peak Voltage [kVp]", 120);
double timeCurrentProduct = UserUtil.queryDouble("Time Current Product [mAs]", 1);
Trajectory trajectory = Configuration.getGlobalConfiguration().getGeometry();
double detectorArea = trajectory.getPixelDimensionX() * trajectory.getDetectorWidth() * trajectory.getDetectorHeight() * trajectory.getPixelDimensionY();
double pixelArea = trajectory.getPixelDimensionX() * trajectory.getPixelDimensionY();
PolychromaticXRaySpectrum spectrum = new PolychromaticXRaySpectrum(min, max, delta, peakVoltage, "W", timeCurrentProduct, trajectory.getSourceToDetectorDistance() / 1000.0, angle, 2.38, 3.06, 2.66, 10.5);
double totalPhotonFlux = spectrum.getTotalPhotonFlux();
/* input energy in J */
double inputEnergy = peakVoltage * timeCurrentProduct;
/* convert to keV */
inputEnergy *= 6.24150934E15;
/* output energy in keV */
double outputEnergy = detectorArea * totalPhotonFlux * spectrum.getAveragePhotonEnergy();
double ratio = outputEnergy / inputEnergy;
Plot plot = new Plot("C-Arm Spectrum with " + detectorArea * totalPhotonFlux + " total photons and " + pixelArea * totalPhotonFlux + " photons per pixel, avg energy "+ spectrum.getAveragePhotonEnergy() + " [keV] and " +ratio*100+ " % energy efficiency", "Energy [keV]", "Photon Flux [photons/mm^2]", spectrum.getPhotonEnergies(), spectrum.getPhotonFlux());
plot.show();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例12: 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);
}
}
示例13: 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");
}
示例14: 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();
}
示例15: 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();
}