ij.measure.ResultsTable.getHeadings()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(66)

本文整理了Java中ij.measure.ResultsTable.getHeadings方法的一些代码示例,展示了ResultsTable.getHeadings的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResultsTable.getHeadings方法的具体详情如下:
包路径:ij.measure.ResultsTable
类名称:ResultsTable
方法名:getHeadings

ResultsTable.getHeadings介绍

[英]Returns the column headings as an array of Strings.
[中]以字符串数组的形式返回列标题。

代码示例

代码示例来源:origin: net.imagej/ij

/** Returns the column headings; headings not suitable as variable names are converted
 *  to valid variable names by replacing non-fitting characters with underscores and
 *  adding underscores. To make unique names, underscores+numbers are added as required. */
public String[] getHeadingsAsVariableNames() {
  return getHeadingsAsVariableNames(getHeadings());
}

代码示例来源:origin: ijpb/MorphoLibJ

private static final boolean hasRowLabelColumn(ResultsTable table)
  {
    return table.getLastColumn() == (table.getHeadings().length-2);
  }
}

代码示例来源: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: imagej/ImageJA

/** Returns the column headings; headings not suitable as variable names are converted
 *  to valid variable names by replacing non-fitting characters with underscores and
 *  adding underscores. To make unique names, underscores+numbers are added as required. */
public String[] getHeadingsAsVariableNames() {
  return getHeadingsAsVariableNames(getHeadings());
}

代码示例来源:origin: ijpb/MorphoLibJ

private double[] getColumnValues(ResultsTable table, String heading)
{
  String[] allHeaders = table.getHeadings();
  // Check if column header corresponds to row label header
  boolean hasRowLabels = hasRowLabelColumn(table);
  if (hasRowLabels && heading.equals(allHeaders[0]))
  {
    // need to parse row label column
    int nr = table.size();
    double[] values = new double[nr];
    for (int r = 0; r < nr; r++)
    {
      String label = table.getLabel(r);
      values[r] = Double.parseDouble(label);
    }
    return values;
  }
  // determine index of column
  int index = table.getColumnIndex(heading);
  if (index == ResultsTable.COLUMN_NOT_FOUND)
  {
    throw new RuntimeException("Unable to find column index from header: " + heading);
  }
  return table.getColumnAsDoubles(index);
}

代码示例来源:origin: net.imagej/ij

String[] columnHeadings = getHeadings();

代码示例来源:origin: net.imagej/ij

private void sort() {
  if (rt==null)
    return;
  String[] headers = rt.getHeadings();
  String[] headers2 = headers;
  if (headers[0].equals("Label")) {
    headers = new String[headers.length-1];
    for (int i=0; i<headers.length; i++)
      headers[i] = headers2[i+1];
  }
  GenericDialog gd = new GenericDialog("Sort Table");
  gd.addChoice ("Column: ", headers, headers[0]);
  gd.showDialog();
  if (gd.wasCanceled()) 
    return;
  String column = gd.getNextChoice();
  rt.sort(column);
  rt.show(title);
  scrollToTop();
  if (Recorder.record)
    Recorder.record("Table.sort", column);
}

代码示例来源:origin: imagej/ImageJA

String[] columnHeadings = getHeadings();

代码示例来源:origin: imagej/ImageJA

private void sort() {
  if (rt==null)
    return;
  String[] headers = rt.getHeadings();
  String[] headers2 = headers;
  if (headers[0].equals("Label")) {
    headers = new String[headers.length-1];
    for (int i=0; i<headers.length; i++)
      headers[i] = headers2[i+1];
  }
  GenericDialog gd = new GenericDialog("Sort Table");
  gd.addChoice ("Column: ", headers, headers[0]);
  gd.showDialog();
  if (gd.wasCanceled()) 
    return;
  String column = gd.getNextChoice();
  rt.sort(column);
  rt.show(title);
  scrollToTop();
  if (Recorder.record)
    Recorder.record("Table.sort", column);
}

代码示例来源:origin: net.imagej/ij

/** Sorts this table on the specified column. TO DO: add string support.*/
public void sort(String column) {
  int col = getColumnIndex(column);
  if (col==COLUMN_NOT_FOUND)
    throw new IllegalArgumentException("Column not found");
  double[] values = new double[size()];
  for (int i=0; i<size(); i++)
    values[i] = getValueAsDouble(col,i);
  int[] indexes = Tools.rank(values);
  ResultsTable rt2 = (ResultsTable)clone();
  String[] headers = getHeadings();
  for (int i=0; i<headers.length; i++) {
    if ("Label".equals(headers[i])) {
      for (int row = 0; row<size(); row++)
        setLabel(rt2.getLabel(indexes[row]), row);
    } else {
      col = getColumnIndex(headers[i]);
      for (int row = 0; row<size(); row++)
        setValue(col, row, rt2.getValueAsDouble(col,indexes[row]));
    }
  }
}

代码示例来源:origin: imagej/ImageJA

/** Sorts this table on the specified column. TO DO: add string support.*/
public void sort(String column) {
  int col = getColumnIndex(column);
  if (col==COLUMN_NOT_FOUND)
    throw new IllegalArgumentException("Column not found");
  double[] values = new double[size()];
  for (int i=0; i<size(); i++)
    values[i] = getValueAsDouble(col,i);
  int[] indexes = Tools.rank(values);
  ResultsTable rt2 = (ResultsTable)clone();
  String[] headers = getHeadings();
  for (int i=0; i<headers.length; i++) {
    if ("Label".equals(headers[i])) {
      for (int row = 0; row<size(); row++)
        setLabel(rt2.getLabel(indexes[row]), row);
    } else {
      col = getColumnIndex(headers[i]);
      for (int row = 0; row<size(); row++)
        setValue(col, row, rt2.getValueAsDouble(col,indexes[row]));
    }
  }
}

代码示例来源:origin: ijpb/MorphoLibJ

String[] headings = this.table.getHeadings();
String defaultHeading = headings[0];
if (defaultHeading.equals("Label") && headings.length > 1)

代码示例来源:origin: net.imagej/ij

if (n<2)
  return;
String[] headings = rt.getHeadings();
int columns = headings.length;
if (columns==0)

代码示例来源:origin: ijpb/MorphoLibJ

String[] headings = table.getHeadings();
String defaultHeading = headings[0];
if (defaultHeading.equals("Label") && headings.length > 1)

代码示例来源:origin: imagej/ImageJA

if (n<2)
  return;
String[] headings = rt.getHeadings();
int columns = headings.length;
if (columns==0)

代码示例来源:origin: ca.mcgill/Sholl_Analysis

gd.addMessage("I. Results Table Import Options:", headerFont);
gd.addStringField("Name of dataset", getDescription(), 20);
final String[] headings = csvRT.getHeadings();
gd.addChoice("Distance column", headings, headings[0]);
gd.addChoice("Intersections column", headings, headings[1]);

相关文章

微信公众号

最新文章

更多