本文整理了Java中ij.measure.ResultsTable.getCounter
方法的一些代码示例,展示了ResultsTable.getCounter
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResultsTable.getCounter
方法的具体详情如下:
包路径:ij.measure.ResultsTable
类名称:ResultsTable
方法名:getCounter
[英]Returns the current value of the measurement counter.
[中]返回测量计数器的当前值。
代码示例来源:origin: net.imagej/imagej-legacy
@Override
public boolean isEmpty() {
return table.getCounter() == 0 && table.getLastColumn() == 0;
}
代码示例来源:origin: ca.mcgill/Sholl_Analysis
/** Checks if table is valid while warning user about it */
private boolean validTable(final ResultsTable table) {
if (table == null) {
return false;
} else if (table.getHeadings().length < 2 || table.getCounter() < 2) {
lError("Profile does not contain enough data points.",
"N.B. At least " + (SMALLEST_DATASET + 1) + " pairs of values are required for curve fitting.");
return false;
} else
return true;
}
代码示例来源:origin: net.imagej/ij
double getResultsCount() {
interp.getParens();
return Analyzer.getResultsTable().getCounter();
}
代码示例来源:origin: imagej/ImageJA
double getResultsCount() {
interp.getParens();
return Analyzer.getResultsTable().getCounter();
}
代码示例来源:origin: stackoverflow.com
import ij.ImagePlus;
import ij.IJ;
import ij.measure.Measurements;
import ij.measure.ResultsTable;
import ij.plugin.filter.Analyzer;
ImagePlus imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
// IJ.setAutoThreshold(imp, "Default");
imp.getProcessor().setAutoThreshold("Default");
// IJ.run("Set Measurements...", "area mean standard modal min median area_fraction limit redirect=None decimal=3");
int measurements = Measurements.AREA + Measurements.MEAN + Measurements.MIN_MAX + Measurements.STD_DEV + Measurements.MODE + Measurements.MEDIAN + Measurements.AREA_FRACTION + Measurements.LIMIT;
// IJ.run(imp, "Measure", "");
ResultsTable rt = new ResultsTable();
Analyzer analyzer = new Analyzer(imp, measurements, rt);
analyzer.measure();
Double result = rt.getValue("Min", rt.getCounter() - 1); // get value of interest
IJ.log(result.toString()); // print to log window
// Alternatively, show the full results table
// rt.show("New Results");
代码示例来源:origin: ca.mcgill/Sholl_Analysis
public TabularParser(final ij.measure.ResultsTable table, final String radiiColumnHeader,
final String countsColumnHeader, final int startRow, final int endRow) {
if (table == null || table.getCounter() == 0)
throw new IllegalArgumentException("Table does not contain valid data");
ij2table = null;
ij1table = table;
radiiCol = table.getColumnIndex(radiiColumnHeader);
countsCol = table.getColumnIndex(countsColumnHeader);
if (radiiCol == ResultsTable.COLUMN_NOT_FOUND || countsCol == ResultsTable.COLUMN_NOT_FOUND)
throw new IllegalArgumentException(
"Specified headings do not match existing ones: " + table.getColumnHeadings());
this.radiiColumnHeader = radiiColumnHeader;
this.startRow = startRow;
this.endRow = endRow;
}
代码示例来源:origin: sc.fiji/mij
/**
* Returns a specifying column the current instance of ResultsTable.
*
* @param heading heading of a column
* @return column specified by its heading
*/
public static Object getColumn(String heading){
ResultsTable rt=Analyzer.getResultsTable();
int col= rt.getColumnIndex(heading);
int counter=rt.getCounter();
double []results=new double[counter];
results=rt.getColumnAsDoubles(col);
return results;
}
代码示例来源:origin: ca.mcgill/Sholl_Analysis
private void buildProfileFromIJ1Table() {
final int lastRow = ij1table.getCounter() - 1;
final int[] rowRange = getFilteredRowRange(lastRow);
final double[] radii = ij1table.getColumnAsDoubles(radiiCol);
final double[] counts = ij1table.getColumnAsDoubles(countsCol);
for (int i = rowRange[0]; i <= rowRange[1]; i++) {
final ProfileEntry entry = new ProfileEntry(radii[i], counts[i], null);
profile.add(entry);
if (!running)
break;
}
}
代码示例来源:origin: sc.fiji/mij
/**
* 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]);
}
}
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Test method for {@link inra.ijpb.binary.geodesic.GeodesicDiameterFloat#analyzeImage(ij.process.ImageProcessor)}.
*/
@Test
public void testAnalyzeImage_Circle()
{
ImagePlus imagePlus = IJ.openImage(getClass().getResource("/files/circles.tif").getFile());
ImageProcessor image = imagePlus.getProcessor();
GeodesicDiameterFloat algo = new GeodesicDiameterFloat(ChamferWeights.CHESSKNIGHT);
ResultsTable table = algo.analyzeImage(image);
assertEquals(1, table.getCounter());
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Test method for {@link inra.ijpb.binary.geodesic.GeodesicDiameterFloat#analyzeImage(ij.process.ImageProcessor)}.
*/
@Test
public void testAnalyzeImage_Grains()
{
ImagePlus imagePlus = IJ.openImage(getClass().getResource("/files/grains-WTH-areaOpen-lbl2.tif").getFile());
ImageProcessor image = imagePlus.getProcessor();
// Need to use weights in 3-by-3 neighborhood, to avoid propagating distances to another grain
GeodesicDiameterFloat algo = new GeodesicDiameterFloat(ChamferWeights.BORGEFORS);
ResultsTable table = algo.analyzeImage(image);
assertEquals(71, table.getCounter());
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Test method for {@link inra.ijpb.binary.geodesic.GeodesicDiameterShort#analyzeImage(ij.process.ImageProcessor)}.
*/
@Test
public void testAnalyzeImage_Grains()
{
ImagePlus imagePlus = IJ.openImage(getClass().getResource("/files/grains-WTH-areaOpen-lbl2.tif").getFile());
ImageProcessor image = imagePlus.getProcessor();
// Need to use weights in 3-by-3 neighborhood, to avoid propagating distances to another grain
GeodesicDiameterShort algo = new GeodesicDiameterShort(ChamferWeights.BORGEFORS);
ResultsTable table = algo.analyzeImage(image);
assertEquals(71, table.getCounter());
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Test method for {@link inra.ijpb.binary.geodesic.GeodesicDiameterShort#analyzeImage(ij.process.ImageProcessor)}.
*/
@Test
public void testAnalyzeImage_Circle()
{
ImagePlus imagePlus = IJ.openImage(getClass().getResource("/files/circles.tif").getFile());
ImageProcessor image = imagePlus.getProcessor();
GeodesicDiameterShort algo = new GeodesicDiameterShort(ChamferWeights.CHESSKNIGHT);
ResultsTable table = algo.analyzeImage(image);
assertEquals(1, table.getCounter());
}
代码示例来源:origin: ijpb/MorphoLibJ
@Test
@Deprecated
public final void testSurfaceArea_SingleBall_D3() {
ImageStack image = createBallImage();
double[] resol = new double[]{1, 1, 1};
ResultsTable table = GeometricMeasures3D.surfaceArea(image, resol, 3);
double exp = 5026.;
assertEquals(1, table.getCounter());
assertEquals(exp, table.getValueAsDouble(0, 0), 2.);
}
代码示例来源:origin: ijpb/MorphoLibJ
@Test
@Deprecated
public final void testSurfaceArea_SingleBall_D13() {
ImageStack image = createBallImage();
double[] resol = new double[]{1, 1, 1};
ResultsTable table = GeometricMeasures3D.surfaceArea(image, resol, 13);
double exp = 5026.;
assertEquals(1, table.getCounter());
assertEquals(exp, table.getValueAsDouble(0, 0), 2.);
}
代码示例来源:origin: ijpb/MorphoLibJ
@Test
@Deprecated
public final void testSurfaceArea_ManyBalls_D13() {
ImageStack image = createManyBallsImage();
double[] resol = new double[]{1, 1, 1};
ResultsTable table = GeometricMeasures3D.surfaceArea(image, resol, 13);
double exp = 2000.;
assertEquals(27, table.getCounter());
for (int i = 0; i < 27; i++)
assertEquals(exp, table.getValueAsDouble(0, i), 2.);
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Test method for {@link inra.ijpb.binary.geodesic.GeodesicDiameterFloat#analyzeImage(ij.process.ImageProcessor)}.
*/
@Test
public void testAnalyzeImage_BatCochlea()
{
String fileName = getClass().getResource("/files/bat-cochlea-volume.tif").getFile();
ImagePlus imagePlus = IJ.openImage(fileName);
assertNotNull(imagePlus);
assertTrue(imagePlus.getStackSize() > 0);
ImageStack image = imagePlus.getStack();
GeodesicDiameter3D algo = new GeodesicDiameter3DFloat(ChamferWeights3D.BORGEFORS);
ResultsTable table = algo.process(image);
assertEquals(1, table.getCounter());
}
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Initialize 20x20 image with a disk of radius 8 in the middle, resulting
* in expected perimeter equal to 50.2655. The center of the disk is
* slightly shifted to reduce discretization artifacts.
*
* Test method for {@link ijt.measure.geometric.GeometricMeasures2D#croftonPerimeter_D2(ij.process.ImageProcessor, double[])}.
*/
@Test
@Deprecated
public final void testAnalyzeRegions_DiskR8_D2()
{
ImageProcessor image = createDiskR8Image();
double[] resol = new double[]{1, 1};
ResultsTable table = GeometricMeasures2D.analyzeRegions(image, resol, 2);
// only one particle should have been detected
assertEquals(1, table.getCounter());
double exp = 2 * Math.PI * 8;
// relative error is expected to be lower than 22% for two directions
assertEquals(exp, table.getValue("Perimeter", 0), exp * .22);
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Initialize 20x20 image with a disk of radius 8 in the middle, resulting
* in expected perimeter equal to 50.2655. The center of the disk is
* slightly shifted to reduce discretization artifacts.
*
* Test method for {@link ijt.measure.geometric.GeometricMeasures2D#croftonPerimeter_D2(ij.process.ImageProcessor, double[])}.
*/
@Test
@Deprecated
public final void testAnalyzeRegions_DiskR8_D4()
{
ImageProcessor image = createDiskR8Image();
double[] resol = new double[]{1, 1};
ResultsTable table = GeometricMeasures2D.analyzeRegions(image, resol, 4);
assertEquals(1, table.getCounter());
double exp = 2 * Math.PI * 8;
// relative error is expected to be lower than 5.2% for four directions
assertEquals(exp, table.getValue("Perimeter", 0), exp * .052);
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Test method for {@link ijt.measure.geometric.GeometricMeasures2D#croftonPerimeter_D2(ij.process.ImageProcessor, double[])}.
*/
@Test
@Deprecated
public final void testAnalyzeRegions_D2()
{
// initialize image with a square of side 4 in the middle
ImageProcessor image = new ByteProcessor(10, 10);
for (int y = 3; y < 7; y++)
{
for (int x = 3; x < 7; x++)
{
image.set(x, y, 255);
}
}
double[] resol = new double[]{1, 1};
ResultsTable table = GeometricMeasures2D.analyzeRegions(image, resol, 2);
assertEquals(1, table.getCounter());
assertEquals(4 * Math.PI, table.getValue("Perimeter", 0), 1e-10);
}
内容来源于网络,如有侵权,请联系作者删除!