本文整理汇总了Java中ij.measure.ResultsTable.show方法的典型用法代码示例。如果您正苦于以下问题:Java ResultsTable.show方法的具体用法?Java ResultsTable.show怎么用?Java ResultsTable.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.measure.ResultsTable
的用法示例。
在下文中一共展示了ResultsTable.show方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showResults
import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
* Show a Results table containing some performance information
*
* @param duration time elapsed in purifying.
* @param imp the purified image.
* @param slicesPerChunk slices processed by each chunk.
* @param labelMethod labelling method used.
*/
private void showResults(final double duration, final ImagePlus imp, int slicesPerChunk, final int labelMethod) {
if (labelMethod == ParticleCounter.LINEAR)
slicesPerChunk = imp.getImageStackSize();
final ParticleCounter pc = new ParticleCounter();
final int nChunks = pc.getNChunks(imp, slicesPerChunk);
final int[][] chunkRanges = pc.getChunkRanges(imp, nChunks, slicesPerChunk);
final ResultsTable rt = ResultsTable.getResultsTable();
rt.incrementCounter();
rt.addLabel(imp.getTitle());
rt.addValue("Algorithm", labelMethod);
rt.addValue("Threads", Runtime.getRuntime().availableProcessors());
rt.addValue("Slices", imp.getImageStackSize());
rt.addValue("Chunks", nChunks);
rt.addValue("Chunk size", slicesPerChunk);
rt.addValue("Last chunk size", chunkRanges[1][nChunks - 1] - chunkRanges[0][nChunks - 1]);
rt.addValue("Duration (s)", duration);
rt.show("Results");
return;
}
示例2: sendToResultTable
import ij.measure.ResultsTable; //导入方法依赖的package包/类
private void sendToResultTable(final float[][] centers, final String[] labels) {
// Send cluster centers to a Result Table
final ResultsTable rt = new ResultsTable();
for (int i = 0; i < centers.length; i++) {
rt.incrementCounter();
final float[] center = centers[i];
rt.addValue("Cluster", i);
if (center.length == 1) {
rt.addValue("Value", center[0]);
} else {
for (int j = 0; j < center.length; j++) {
final float v = center[j];
rt.addValue(labels[j] != null ? "" + labels[j] : "Band " + j, v);
}
}
}
rt.show(RESULTS_WINDOW_TITLE);
}
示例3: deleteRows
import ij.measure.ResultsTable; //导入方法依赖的package包/类
/** Deletes 'row1' through 'row2' of the "Results" window. Arguments
must be in the range 0-Analyzer.getCounter()-1. */
public static void deleteRows(int row1, int row2) {
int n = row2 - row1 + 1;
ResultsTable rt = Analyzer.getResultsTable();
for (int i=row1; i<row1+n; i++)
rt.deleteRow(row1);
rt.show("Results");
}
示例4: findThreshold
import ij.measure.ResultsTable; //导入方法依赖的package包/类
public double findThreshold(ImagePlus imp, long percentileNum){
ResultsTable rt = new ResultsTable();
long[] histogram = null; //is.histogram;
long totalCount = 0;
double value = 0.0;
double binWidth = 0.0;
StackStatistics ss1 = new StackStatistics(imp);
double max = ss1.histMax;
histogram = ss1.getHistogram();
if(imp.getBitDepth() == 8 || imp.getBitDepth() == 24){
for(int i = histogram.length - 1; i > - 1; i--){
rt.setValue("Value", i, i);
rt.setValue("Count", i, histogram[i]);
if(percentileNum < totalCount){
return value;
}
}
}else{
value = max;
binWidth = ss1.binSize;
histogram = ss1.getHistogram();
for(int i = histogram.length - 1; i > - 1; i--){
value -= binWidth;
totalCount += histogram[i];
if(percentileNum < totalCount){
return value;
}
}
rt.show("Threshold Results");
}
return 0.0;
}
示例5: run
import ij.measure.ResultsTable; //导入方法依赖的package包/类
@Override
public void run(final ImageProcessor ignored) {
// Analyze skeleton
final AnalyzeSkeleton_ as = new AnalyzeSkeleton_();
as.setup("", imp);
final SkeletonResult sr = as.run();
// Get key skeleton properties
final int nTrees = sr.getNumOfTrees();
final int[] branches = sr.getBranches();
final int nBranches = IntStream.of(branches).sum();
if (branches == null || (nBranches == 0 && nTrees <= 1)) {
Utils.error("Summarize Skeleton", "Image does not seem to be a branched skeleton.", imp);
return;
}
final ResultsTable rt = Utils.getTable(TABLE_TITLE);
try {
// Integrate values from all trees
double sumLength = 0d;
final double[] avgLengths = sr.getAverageBranchLength();
for (int i = 0; i < nTrees; i++)
sumLength += avgLengths[i] * branches[i];
// Log stats
rt.incrementCounter();
rt.addValue("Image", imp.getTitle());
rt.addValue("Unit", imp.getCalibration().getUnits());
rt.addValue("Total length", sumLength);
rt.addValue("Max branch length", StatUtils.max(sr.getMaximumBranchLength()));
rt.addValue("Mean branch length", StatUtils.mean(avgLengths));
rt.addValue("# Trees", nTrees);
rt.addValue("# Branches", nBranches);
rt.addValue("# Junctions", IntStream.of(sr.getJunctions()).sum());
rt.addValue("# End-points", IntStream.of(sr.getEndPoints()).sum());
rt.addValue("# Triple Points", IntStream.of(sr.getTriples()).sum());
rt.addValue("# Quadruple Points", IntStream.of(sr.getQuadruples()).sum());
rt.addValue("Sum of voxels", IntStream.of(sr.calculateNumberOfVoxels()).sum());
} catch (final Exception ignored1) {
Utils.error("Summarize Skeleton", "Some statistics could not be calculated", imp);
} finally {
rt.show(TABLE_TITLE);
}
}
示例6: getHyperstackProfile
import ij.measure.ResultsTable; //导入方法依赖的package包/类
private float[] getHyperstackProfile(Roi roi, double minThreshold, double maxThreshold) {
int slices = imp.getNSlices();
int frames = imp.getNFrames();
int c = imp.getC();
int z = imp.getZ();
int t = imp.getT();
int size = slices;
if (firstTime)
timeProfile = slices==1 && frames>1;
if (slices>1 && frames>1 && (!isPlotMaker ||firstTime)) {
showingDialog = true;
GenericDialog gd = new GenericDialog("Profiler");
gd.addChoice("Profile", choices, choice);
gd.showDialog();
if (gd.wasCanceled())
return null;
choice = gd.getNextChoice();
timeProfile = choice.equals(choices[0]);
}
if (timeProfile)
size = frames;
else
size = slices;
float[] values = new float[size];
Calibration cal = imp.getCalibration();
Analyzer analyzer = new Analyzer(imp);
int measurements = Analyzer.getMeasurements();
boolean showResults = !isPlotMaker && measurements!=0 && measurements!=LIMIT;
measurements |= MEAN;
if (showResults) {
if (!Analyzer.resetCounter())
return null;
}
ImageStack stack = imp.getStack();
for (int i=1; i<=size; i++) {
int index = 1;
if (timeProfile)
index = imp.getStackIndex(c, z, i);
else
index = imp.getStackIndex(c, i, t);
ImageProcessor ip = stack.getProcessor(index);
if (minThreshold!=ImageProcessor.NO_THRESHOLD)
ip.setThreshold(minThreshold,maxThreshold,ImageProcessor.NO_LUT_UPDATE);
ip.setRoi(roi);
ImageStatistics stats = ImageStatistics.getStatistics(ip, measurements, cal);
analyzer.saveResults(stats, roi);
values[i-1] = (float)stats.mean;
}
if (showResults) {
ResultsTable rt = Analyzer.getResultsTable();
rt.show("Results");
}
return values;
}
示例7: getZAxisProfile
import ij.measure.ResultsTable; //导入方法依赖的package包/类
private float[] getZAxisProfile(Roi roi, double minThreshold, double maxThreshold) {
ImageStack stack = imp.getStack();
if (firstTime) {
int slices = imp.getNSlices();
int frames = imp.getNFrames();
timeProfile = slices==1 && frames>1;
}
int size = stack.getSize();
float[] values = new float[size];
Calibration cal = imp.getCalibration();
Analyzer analyzer = new Analyzer(imp);
int measurements = Analyzer.getMeasurements();
boolean showResults = !isPlotMaker && measurements!=0 && measurements!=LIMIT;
boolean showingLabels = firstTime && showResults && ((measurements&LABELS)!=0 || (measurements&SLICE)!=0);
measurements |= MEAN;
if (showResults) {
if (!Analyzer.resetCounter())
return null;
}
boolean isLine = roi!=null && roi.isLine();
int current = imp.getCurrentSlice();
for (int i=1; i<=size; i++) {
if (showingLabels)
imp.setSlice(i);
ImageProcessor ip = stack.getProcessor(i);
if (minThreshold!=ImageProcessor.NO_THRESHOLD)
ip.setThreshold(minThreshold,maxThreshold,ImageProcessor.NO_LUT_UPDATE);
ip.setRoi(roi);
ImageStatistics stats = null;
if (isLine)
stats = getLineStatistics(roi, ip, measurements, cal);
else
stats = ImageStatistics.getStatistics(ip, measurements, cal);
analyzer.saveResults(stats, roi);
values[i-1] = (float)stats.mean;
}
if (showResults) {
ResultsTable rt = Analyzer.getResultsTable();
rt.show("Results");
}
if (showingLabels)
imp.setSlice(current);
return values;
}
示例8: actionPerformed
import ij.measure.ResultsTable; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == correctResultsButton) {
ResultsTable table = Analyzer.getResultsTable();
if (table == null) {
IJ.showMessage("No results table!");
return;
}
for (int i = 0; i < table.getCounter(); i++) {
double slice = table.getValue("slice", i);
double x = table.getValue("x", i) - polynomial(slice - 1, xParameters);
double y = table.getValue("y", i) - polynomial(slice - 1, yParameters);
table.setValue("x", i, x);
table.setValue("y", i, y);
}
table.show("Results");
}
else if (e.getSource() == correctImageButton) {
ImagePlus imp = IJ.getImage();
ImageStack stack = imp.getStack();
for (int i = 0; i < stack.getSize(); i++) {
ImageProcessor ip = stack.getProcessor(i + 1);
ip.setInterpolationMethod(ImageProcessor.BILINEAR);
double dx = -polynomial(i, xParameters);
double dy = -polynomial(i, yParameters);
ip.translate(dx, dy);
}
imp.show();
}
}
示例9: createResultsTable
import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
* Creates the results table.
*
* @param showJunctions
* the show junctions
*/
private void createResultsTable(boolean showJunctions) {
ResultsTable rt = ResultsTable.getResultsTable();
ResultsTable rtSum = new ResultsTable();
rt.setPrecision(3);
Calibration cal = imp.getCalibration();
for (Lines contours : result) {
for (Line c : contours) {
double meanWidth = 0;
for (int i = 0; i < c.num; i++) {
rt.incrementCounter();
rt.addValue("Frame", contours.getFrame());
rt.addValue("Contour ID", c.getID());
rt.addValue("Pos.", i + 1);
rt.addValue("X", c.col[i] * cal.pixelWidth);
rt.addValue("Y", c.row[i] * cal.pixelHeight);
rt.addValue("Length", c.estimateLength() * cal.pixelHeight);
if (doCorrectPosition && doEstimateWidth) {
rt.addValue("Contrast", Math.abs(c.intensity[i]));
rt.addValue("Asymmetry", Math.abs(c.asymmetry[i]));
}
if (doEstimateWidth) {
rt.addValue("Line width", (c.width_l[i] + c.width_r[i]) * cal.pixelWidth);
meanWidth += c.width_l[i] + c.width_r[i];
rt.addValue("Angle of normal", c.angle[i]);
}
rt.addValue("Class", c.getContourClass().toString().substring(5));
}
rtSum.incrementCounter();
rtSum.addValue("Frame", contours.getFrame());
rtSum.addValue("Contour ID", c.getID());
rtSum.addValue("Length", c.estimateLength() * cal.pixelWidth);
if (doEstimateWidth) {
rtSum.addValue("Mean line width", meanWidth / c.num * cal.pixelWidth);
}
}
}
rt.show("Results");
rtSum.show("Summary");
if (showJunctions) {
ResultsTable rt2 = new ResultsTable();
rt2.setPrecision(0);
for (Junctions junctions : resultJunction) {
for (Junction j : junctions) {
rt2.incrementCounter();
rt2.addValue("Frame", junctions.getFrame());
rt2.addValue("Contour ID 1", j.getLine1().getID());// c.get( j.cont1)
rt2.addValue("Contour ID 2", j.getLine2().getID());
rt2.addValue("X", j.x * cal.pixelWidth);
rt2.addValue("Y", j.y * cal.pixelHeight);
}
}
rt2.show("Junctions");
}
}