ij.plugin.ResultsSorter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of imagej Show documentation
Show all versions of imagej Show documentation
Image processing and analysis framework. Allows the user to
record/replay macros and can be extended using plug-ins.
The newest version!
package ij.plugin;
import ij.*;
import ij.gui.*;
import ij.process.*;
import ij.measure.*;
import java.util.*;
/** This plugin implements the Results Table's Sort command. */
public class ResultsSorter implements PlugIn {
static String parameter = "Area";
public void run(String arg) {
ResultsTable rt = ResultsTable.getResultsTable();
int count = rt.getCounter();
if (count==0) {
IJ.error("Sort", "The \"Results\" table is empty");
return;
}
String head= rt.getColumnHeadings();
StringTokenizer t = new StringTokenizer(head, "\t");
int tokens = t.countTokens()-1;
String[] strings = new String[tokens];
strings[0] = t.nextToken(); // first token is empty?
for(int i=0; i=0)
data = rt.getColumn(index);
if (data==null) {
IJ.error("Sort", "No available results: \""+parameter+"\"");
return;
}
}
private int getIndex(String[] strings) {
for (int i=0; i