本文整理汇总了Java中ij.measure.ResultsTable.incrementCounter方法的典型用法代码示例。如果您正苦于以下问题:Java ResultsTable.incrementCounter方法的具体用法?Java ResultsTable.incrementCounter怎么用?Java ResultsTable.incrementCounter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.measure.ResultsTable
的用法示例。
在下文中一共展示了ResultsTable.incrementCounter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setColumn
import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
* Set a specifying column into the current instance ResultsTable.
*
* @param heading heading of a column
* @param object
*/
public static void setColumn(String heading, Object object){
ResultsTable rt=Analyzer.getResultsTable();
int col= rt.getColumnIndex(heading);
if (col==ResultsTable.COLUMN_NOT_FOUND)
col=rt.getFreeColumn(heading);
int cc=rt.getCounter();
if (object instanceof double[]) {
double[] values = (double[]) object;
for (int i=0; i<values.length; i++){
if (cc<=i) rt.incrementCounter();
rt.setValue(col, i, values[i]);
}
}
}
示例4: addToResultsTable
import ij.measure.ResultsTable; //导入方法依赖的package包/类
public static void addToResultsTable(ResultsTable table, double[] parameters, double[] errors, int slice) {
// sigma_x and sigma_y should always be absolute
parameters[4] = Math.abs(parameters[4]);
parameters[5] = Math.abs(parameters[5]);
table.incrementCounter();
table.addValue("baseline", parameters[0]);
table.addValue("height", parameters[1]);
table.addValue("x", parameters[2]);
table.addValue("y", parameters[3]);
table.addValue("sigma_x", parameters[4]);
table.addValue("sigma_y", parameters[5]);
double fwhmx = parameters[4] * SIGMA_TO_FWHM;
double fwhmy = parameters[5] * SIGMA_TO_FWHM;
table.addValue("fwhm_x", fwhmx);
table.addValue("fwhm_y", fwhmy);
table.addValue("fwhm", (fwhmx + fwhmy) / 2);
table.addValue("error_baseline", errors[0]);
table.addValue("error_height", errors[1]);
table.addValue("error_x", errors[2]);
table.addValue("error_y", errors[3]);
table.addValue("error_sigma_x", errors[4]);
table.addValue("error_sigma_y", errors[5]);
double errorFwhmx = errors[4] * SIGMA_TO_FWHM;
double errorFwhmy = errors[5] * SIGMA_TO_FWHM;
table.addValue("error_fwhm_x", errorFwhmx);
table.addValue("error_fwhm_y", errorFwhmy);
table.addValue("error_fwhm", Math.sqrt(errorFwhmx * errorFwhmx + errorFwhmy * errorFwhmy) / 2);
table.addValue("slice", slice);
}
示例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: 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");
}
}
示例7: main
import ij.measure.ResultsTable; //导入方法依赖的package包/类
public static void main(String[] args) {
System.out.println("creating results table...");
ResultsTable rt = new ResultsTable();
for (int i = 0; i < 1e6; i++) {
rt.incrementCounter();
rt.setValue("x", i, (int)(Math.random() * 1000));
rt.setValue("y", i, (int)(Math.random() * 1000));
}
ResultsTableSorter.sort(rt, true, "x", "y");
// test table
System.out.println("testing results table...");
System.out.println("number of rows : " + rt.getCounter());
//System.out.println("x\ty");
//System.out.println(rt.getValue("x", 0) + "\t" + rt.getValue("y", 0));
for (int i = 1; i < rt.getCounter(); i++) {
//System.out.println(rt.getValue("x", i) + "\t" + rt.getValue("y", i));
int x1 = (int)rt.getValue("x", i - 1);
int x2 = (int)rt.getValue("x", i);
int y1 = (int)rt.getValue("y", i - 1);
int y2 = (int)rt.getValue("y", i);
if (x1 > x2) {
System.out.println("not sorted");
break;
}
if (x1 == x2 && y1 > y2) {
System.out.println("group not sorted");
break;
}
}
System.out.println("done");
}