本文整理了Java中ij.measure.ResultsTable.getValue
方法的一些代码示例,展示了ResultsTable.getValue
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResultsTable.getValue
方法的具体详情如下:
包路径:ij.measure.ResultsTable
类名称:ResultsTable
方法名:getValue
暂无
代码示例来源: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: sc.fiji/Manual_Tracking
int nbtrack=(int) rt.getValue(0,i);
int nbslices=(int) rt.getValue(1,i);
int cx=(int) rt.getValue(2,i);
int cy=(int) rt.getValue(3,i);
int lim=img.getStackSize()+1;
if ((nbtrack != nbtrackold)) {
if ((int) (rt.getValue(0,n)) == nbtrack) lim=(int) rt.getValue(1,n);
代码示例来源:origin: sc.fiji/Manual_Tracking
void Dots(){
dotsize=(int) Tools.parseDouble(dotsizefield.getText());
j=0;
int nbtrackold=1;
for (i=0; i<(rt.getCounter()); i++) {
int nbtrack=(int) rt.getValue(0,i);
int nbslices=(int) rt.getValue(1,i);
int cx=(int) rt.getValue(2,i);
int cy=(int) rt.getValue(3,i);
if ((nbtrack != nbtrackold)) j++;
if (j>6) j=0;
ImageProcessor ip= stack.getProcessor(nbslices);
ip.setColor(col[j]);
ip.setLineWidth(dotsize);
ip.drawDot(cx, cy);
if (checkText.getState()){
Font font = new Font("SansSerif", Font.PLAIN, (int) Tools.parseDouble(fontsizefield.getText()));
ip.setFont(font);
ip.drawString(""+nbtrack, cx+(dotsize-5)/2, cy-(dotsize-5)/2);
}
nbtrackold=nbtrack;
}
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Test method for {@link ijt.measure.geometric.GeometricMeasures2D#inertiaEllipse(ij.process.ImageProcessor)}.
*/
@Test
public final void testAnalyzeRegions_OrientedEllipse()
{
String fileName = getClass().getResource("/files/ellipse_A40_B20_T30.tif").getFile();
ImagePlus imagePlus = IJ.openImage(fileName);
assertNotNull(imagePlus);
InertiaEllipse op = new InertiaEllipse();
ResultsTable table = op.computeTable(imagePlus);
assertEquals(49.5, table.getValue("Ellipse.Center.X", 0), .1);
assertEquals(49.5, table.getValue("Ellipse.Center.Y", 0), .1);
assertEquals(40, table.getValue("Ellipse.Radius1", 0), .2);
assertEquals(20, table.getValue("Ellipse.Radius2", 0), .2);
assertEquals(30, table.getValue("Ellipse.Orientation", 0), 1);
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Test method for {@link ijt.measure.geometric.GeometricMeasures2D#inertiaEllipse(ij.process.ImageProcessor)}.
*/
@Test
@Deprecated
public final void testInertiaEllipse()
{
String fileName = getClass().getResource("/files/ellipse_A40_B20_T30.tif").getFile();
ImagePlus imagePlus = IJ.openImage(fileName);
assertNotNull(imagePlus);
ImageProcessor image = (ImageProcessor) imagePlus.getProcessor();
ResultsTable table = GeometricMeasures2D.inertiaEllipse(image);
assertEquals(49.5, table.getValue("Ellipse.Center.X", 0), .1);
assertEquals(49.5, table.getValue("Ellipse.Center.Y", 0), .1);
assertEquals(40, table.getValue("Ellipse.Radius1", 0), .2);
assertEquals(20, table.getValue("Ellipse.Radius2", 0), .2);
assertEquals(30, table.getValue("Ellipse.Orientation", 0), 1);
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Test method for {@link ijt.measure.geometric.GeometricMeasures2D#maxInscribedCircle(ij.process.ImageProcessor)}.
*/
@Test
@Deprecated
public final void testMaxInscribedCircle()
{
ImageProcessor image = new ByteProcessor(14, 9);
image.set(1, 1, 1);
fillRect(image, 3, 4, 1, 2, 2); // radius 2
fillRect(image, 1, 1+3, 4, 4+3, 3); // radius 4
fillRect(image, 6, 6+6, 1, 1+6, 4); // radius 7
ResultsTable table = GeometricMeasures2D.maximumInscribedCircle(image);
assertEquals(1, table.getValue("InscrCircle.Radius", 0), .1);
assertEquals(1, table.getValue("InscrCircle.Radius", 1), .1);
assertEquals(2, table.getValue("InscrCircle.Radius", 2), .1);
assertEquals(4, table.getValue("InscrCircle.Radius", 3), .1);
}
代码示例来源:origin: net.imagej/ij
/** Saves statistics for one particle in a results table. This is
a method subclasses can override. */
protected void saveResults(ImageStatistics stats, Roi roi) {
analyzer.saveResults(stats, roi);
if (maxCircularity>1.0 && rt.columnExists("Circ.") && rt.getValue("Circ.", rt.size()-1)==1.0) {
double perimeter = roi.getLength();
double circularity = perimeter==0.0?0.0:4.0*Math.PI*(stats.pixelCount/(perimeter*perimeter));
rt.addValue("Circ.", circularity);
}
if (recordStarts) {
rt.addValue("XStart", stats.xstart);
rt.addValue("YStart", stats.ystart);
}
if (showResultsWindow && showResults)
rt.addResults();
}
代码示例来源:origin: imagej/ImageJA
/** Saves statistics for one particle in a results table. This is
a method subclasses can override. */
protected void saveResults(ImageStatistics stats, Roi roi) {
analyzer.saveResults(stats, roi);
if (maxCircularity>1.0 && rt.columnExists("Circ.") && rt.getValue("Circ.", rt.size()-1)==1.0) {
double perimeter = roi.getLength();
double circularity = perimeter==0.0?0.0:4.0*Math.PI*(stats.pixelCount/(perimeter*perimeter));
rt.addValue("Circ.", circularity);
}
if (recordStarts) {
rt.addValue("XStart", stats.xstart);
rt.addValue("YStart", stats.ystart);
}
if (showResultsWindow && showResults)
rt.addResults();
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Add a results table to the already existing table.
* @param rt table to add
* @return current results builder
*/
public ResultsBuilder addResult (ResultsTable rt) {
// Keep the label and everything in the same order as before, but just append whatever columns do not exist yet
if(allResults.size() == rt.size() ) {
for(int c=0; c<=rt.getLastColumn(); c++) {
String colName = rt.getColumnHeading(c);
if( !allResults.columnExists(colName)) {
for(int i=0; i<rt.getCounter(); i++) {
allResults.setValue(colName, i, rt.getValue(colName, i)); // Currently only supports numbered results...
}
}
}
} else { // Overwrite
this.allResults = rt;
}
return this;
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Test method for {@link inra.ijpb.measure.region2d.LargestInscribedCircle#analyzeRegions(ij.ImagePlus)}.
*/
@Test
public final void testAnalyzeRegionsImagePlus_Rectangles()
{
ImageProcessor image = new ByteProcessor(14, 9);
image.set(1, 1, 1);
fillRect(image, 3, 4, 1, 2, 2); // radius 2
fillRect(image, 1, 1+3, 4, 4+3, 3); // radius 4
fillRect(image, 6, 6+6, 1, 1+6, 4); // radius 7
LargestInscribedCircle op = new LargestInscribedCircle();
ResultsTable table = op.createTable(op.analyzeRegions(image, new Calibration()));
assertEquals(1, table.getValue("InscrCircle.Radius", 0), .1);
assertEquals(1, table.getValue("InscrCircle.Radius", 1), .1);
assertEquals(2, table.getValue("InscrCircle.Radius", 2), .1);
assertEquals(4, table.getValue("InscrCircle.Radius", 3), .1);
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Get the false negative error between two label images (source and target)
* per each individual labeled region.
* <p>
* False Negative Error (for each individual labeled region r) $FN_r = \frac{ |T_r \setminus S_r| }{ |T_r| }$.
* @param sourceImage source label image
* @param targetImage target label image
* @return false negative error per label or null if error
* @see <a href="http://www.insight-journal.org/browse/publication/707">http://www.insight-journal.org/browse/publication/707</a>
*/
public static final ResultsTable getFalseNegativeErrorPerLabel(
ImageStack sourceImage,
ImageStack targetImage )
{
ResultsTable toTable = LabelImages.getTargetOverlapPerLabel( sourceImage, targetImage );
// create data table
ResultsTable fneTable = new ResultsTable();
for (int i = 0; i < toTable.getCounter(); i++) {
fneTable.incrementCounter();
fneTable.addLabel( toTable.getLabel( i ) );
fneTable.addValue( "FalseNegativeError", 1.0 - toTable.getValue("TargetOverlap", i) );
}
return fneTable;
}
代码示例来源:origin: net.imagej/ij
rtMulti.addValue(head+suffix, rtSys.getValue(j,rtSys.getCounter()-1));
代码示例来源: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: imagej/ImageJA
rtMulti.addValue(head+suffix, rtSys.getValue(j,rtSys.getCounter()-1));
代码示例来源: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: net.imagej/ij
double v = rt.getValue(headings[col], row);
if (v<min[col]) min[col]=v;
if (v>max[col]) max[col]=v;
代码示例来源:origin: imagej/ImageJA
double v = rt.getValue(headings[col], row);
if (v<min[col]) min[col]=v;
if (v>max[col]) max[col]=v;
代码示例来源: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);
}
代码示例来源:origin: ijpb/MorphoLibJ
/**
* Get the false negative error between two label images (source and target)
* per each individual labeled region.
* <p>
* False Negative Error (for each individual labeled region r) $FN_r = \frac{ |T_r \setminus S_r| }{ |T_r| }$.
* @param sourceImage source label image
* @param targetImage target label image
* @return false negative error per label or null if error
* @see <a href="http://www.insight-journal.org/browse/publication/707">http://www.insight-journal.org/browse/publication/707</a>
*/
public static final ResultsTable getFalseNegativeErrorPerLabel(
ImageProcessor sourceImage,
ImageProcessor targetImage )
{
if( sourceImage.getWidth() != targetImage.getWidth() ||
sourceImage.getHeight() != targetImage.getHeight() )
return null;
ResultsTable toTable = LabelImages.getTargetOverlapPerLabel( sourceImage, targetImage );
// create data table
ResultsTable fneTable = new ResultsTable();
for (int i = 0; i < toTable.getCounter(); i++) {
fneTable.incrementCounter();
fneTable.addLabel( toTable.getLabel( i ) );
fneTable.addValue( "FalseNegativeError", 1.0 - toTable.getValue("TargetOverlap", i) );
}
return fneTable;
}
/**
代码示例来源:origin: ijpb/MorphoLibJ
assertEquals(built_results.getValue("Metric 1", i), rt1.getValue("Metric 1", i), 0.0);
assertEquals(built_results.getValue("Metric 2", i), rt2.getValue("Metric 2", i), 0.0);
assertEquals(built_results.getValue("Metric 3", i), rt3.getValue("Metric 3", i), 0.0);
内容来源于网络,如有侵权,请联系作者删除!