本文整理汇总了Java中ij.plugin.filter.Analyzer.getResultsTable方法的典型用法代码示例。如果您正苦于以下问题:Java Analyzer.getResultsTable方法的具体用法?Java Analyzer.getResultsTable怎么用?Java Analyzer.getResultsTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.plugin.filter.Analyzer
的用法示例。
在下文中一共展示了Analyzer.getResultsTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResultsTable
import ij.plugin.filter.Analyzer; //导入方法依赖的package包/类
/**
* Returns the instance of the ResultsTable.
*
* @return Instance of the ResultsTable
*/
public static Object getResultsTable(){
ResultsTable rt=Analyzer.getResultsTable();
int col=0;
int[] index=new int[ResultsTable.MAX_COLUMNS];
for (int cnt=0;cnt<ResultsTable.MAX_COLUMNS; cnt++) {
if (rt.columnExists(cnt)){
index[col]=cnt;
col++;
}
}
int counter=rt.getCounter();
double [][] results=new double[counter][col];
for( int i=0;i<col;i++) {
for( int j=0;j<counter;j++) {
results[j][i]=rt.getValueAsDouble(index[i],j);
}
}
return results;
}
示例2: setColumn
import ij.plugin.filter.Analyzer; //导入方法依赖的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]);
}
}
}
示例3: getListColumns
import ij.plugin.filter.Analyzer; //导入方法依赖的package包/类
/**
* Returns the list of columns currently used in the ResultsTable.
*
* @return list of columns
*/
public static String[] getListColumns() {
ResultsTable rt = Analyzer.getResultsTable();
StringTokenizer st = new StringTokenizer(rt.getColumnHeadings());
int n = st.countTokens();
String[] strings = new String[n];
for (int i = 0; i < n; i++) {
strings[i] =st.nextToken();
}
return strings;
}
示例4: getColumn
import ij.plugin.filter.Analyzer; //导入方法依赖的package包/类
/**
* 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;
}
示例5: deleteRows
import ij.plugin.filter.Analyzer; //导入方法依赖的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");
}
示例6: resultsExample
import ij.plugin.filter.Analyzer; //导入方法依赖的package包/类
void resultsExample()
{
ResultsTable rt = Analyzer.getResultsTable();
if (rt == null) {
rt = new ResultsTable();
Analyzer.setResultsTable(rt);
}
for (int i = 1; i <= 10; i++) {
rt.incrementCounter();
rt.addValue("i", i);
rt.addValue("log", Math.log(i));
}
rt.show("Results");
}
示例7: takeMeasure
import ij.plugin.filter.Analyzer; //导入方法依赖的package包/类
private static String takeMeasure(Roi roi, ImagePlus imp, Hashtable<String, String> toMeasure, LinkedList<BacteriaMeasurement> measurements, int collarSize, int idBacteria, int frameNo, int idRoiType, int idChannel ) {
roi.setImage(imp);
imp.setRoi(roi);
Analyzer.getResultsTable().reset();
// for the time being, I'm using default ResultTable and delete it (and measurements options)
Analyzer analyzer = new Analyzer(roi.getImage());
analyzer.measure();
ResultsTable rt = Analyzer.getResultsTable();
String dbg = " ";
DecimalFormat df = new DecimalFormat("0.00");
for (int i = 0; i <= rt.getLastColumn(); ++i) {
try {
// ControlPanel.addStatusMessage("toMeasure.containsKey(" + rt.getColumnHeading(i).toLowerCase() + ")) = " + toMeasure.containsKey(rt.getColumnHeading(i).toLowerCase()));
if (toMeasure.containsKey(rt.getColumnHeading(i).toLowerCase())) {
BacteriaMeasurement bm = new BacteriaMeasurement (
idBacteria,
frameNo,
DALService.getMeasurementId(rt.getColumnHeading(i)),
rt.getValueAsDouble(i, 0),
idRoiType,
idChannel
);
dbg += rt.getColumnHeading(i) + "(" + collarSize + ") = " + df.format(rt.getValueAsDouble(i, 0)) + "\t";
measurements.add(bm);
}
} catch (Exception e) {
// Dirty, I know, I haven't figured out the better way.
// Don't like parsing rt.getColumnHeadings() any better
}
}
return dbg;
}
示例8: getHyperstackProfile
import ij.plugin.filter.Analyzer; //导入方法依赖的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;
}
示例9: getZAxisProfile
import ij.plugin.filter.Analyzer; //导入方法依赖的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;
}
示例10: actionPerformed
import ij.plugin.filter.Analyzer; //导入方法依赖的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();
}
}
示例11: ResultsTableFilter
import ij.plugin.filter.Analyzer; //导入方法依赖的package包/类
public ResultsTableFilter() {
table = Analyzer.getResultsTable();
}
示例12: ResultsTableSorter
import ij.plugin.filter.Analyzer; //导入方法依赖的package包/类
public ResultsTableSorter() {
table = Analyzer.getResultsTable();
}
示例13: ResultsTablePlotter
import ij.plugin.filter.Analyzer; //导入方法依赖的package包/类
public ResultsTablePlotter() {
table = Analyzer.getResultsTable();
}
示例14: run
import ij.plugin.filter.Analyzer; //导入方法依赖的package包/类
@Override
public void run(String args) {
ResultsTable rt = Analyzer.getResultsTable();
// Is the number of columns right?
int nCols = rt.getLastColumn();
if (nCols == -1) {
IJ.error("The Results table is empty.");
return;
} else if (nCols < 3) {
IJ.error("The Results table does not contain enough columns.");
return;
}
// Are the headings the right ones?
String [] headings = rt.getHeadings();
if (!headings[0].equals("x") || !headings[1].equals("y")
|| !headings[2].equals("slice")) {
IJ.error("The headings for the first three columns are wrong.");
return;
}
int [] x = _float2int(rt.getColumn(0));
int [] y = _float2int(rt.getColumn(1));
int [] slices = _float2int(rt.getColumn(2));
float [] param = rt.getColumn(3);
int max_x = _getMax(x);
int max_y = _getMax(y);
int max_slice = _getMax(slices);
// We need to ask the user for the image dimensions, as there is no
// way of guessing them from the coordinate values (the voxels have
// probably been masked beforehand). In any case, use the maximum
// read value for each dimension.
GenericDialog gd = new GenericDialog("Please set the image dimensions");
gd.addNumericField("X", max_x, 0);
gd.addNumericField("Y", max_y, 0);
gd.addNumericField("Slices", max_slice, 0);
gd.showDialog();
if (gd.wasCanceled())
return;
int dim_x = (int)Math.round(gd.getNextNumber());
int dim_y = (int)Math.round(gd.getNextNumber());
int dim_slice = (int)Math.round(gd.getNextNumber());
// Check that the user provided values are correct
if (dim_x < max_x || dim_y < max_y || dim_slice < max_slice) {
IJ.error("The provided values are lower than some of the " +
"coordinates read from the Results table.");
return;
}
// Build the image
ImagePlus imp = IJ.createImage("Results to Static image", dim_x, dim_y,
dim_slice, 32);
ImageStack is = imp.getStack();
// Populate the stack
for (int i = 0; i < x.length; i++) {
is.setVoxel(x[i], y[i], slices[i] - 1, param[i]);
}
// Display the image
imp.show();
}
示例15: run
import ij.plugin.filter.Analyzer; //导入方法依赖的package包/类
@Override
public void run(String args) {
// Dimensions check
imp = IJ.getImage();
dim = imp.getDimensions();
// If not a HyperStack, return
if (dim[4] < 2) {
IJ.error("Not a HyperStack", "This plugin needs a HyperStack");
return;
}
// Assign rest of variables
is = imp.getStack();
cal = imp.getCalibration();
double calzero = cal.getCValue(0.0);
ResultsTable rt = Analyzer.getResultsTable();
for (int z = 0; z < dim[3]; z++) {
// Update progress bar indicator
IJ.showProgress(z, dim[3]);
for (int x = 0; x < dim[0]; x++) {
for (int y = 0; y < dim[1]; y++) {
// Obtain the TAC
double[] tac = getTAC(x, y, z + 1, dim[4], imp, is, cal);
// Ignore masked voxels and store the valid ones as
// rows on the results table (coordinates first).
if (!isMasked(tac, calzero)) {
rt.incrementCounter();
rt.addValue("x", x);
rt.addValue("y", y);
rt.addValue("slice", z + 1);
for(int i = 0; i < tac.length; i++) {
String colName = String.format("F%d", i);
rt.addValue(colName, tac[i]);
}
}
}
}
}
rt.showRowNumbers(false);
rt.show("Results");
}