use of ij.measure.ResultsTable in project TrakEM2 by trakem2.
the class Selection method measure.
/**
* Call measure(ResultsTable) on every selected Displayable.
*/
public void measure() {
Utils.log2("Selection.measure");
final HashMap<Class<?>, ResultsTable> rts = new HashMap<Class<?>, ResultsTable>();
for (final Displayable d : getSelected()) {
Utils.log2("measured " + d);
ResultsTable rt1 = rts.get(d.getClass());
ResultsTable rt2 = d.measure(rt1);
if (null == rt1 && null != rt2)
rts.put(d.getClass(), rt2);
}
Utils.showAllTables(rts);
}
use of ij.measure.ResultsTable in project TrakEM2 by trakem2.
the class Utils method createResultsTable.
/**
* Creates a new ResultsTable with the given window title and column titles, and 2 decimals of precision, or if one exists for the given window title, returns it.
*/
public static final ResultsTable createResultsTable(final String title, final String[] columns) {
try {
return new TaskOnEDT<ResultsTable>(new Callable<ResultsTable>() {
@Override
public ResultsTable call() {
final TextWindow tw = (TextWindow) WindowManager.getFrame(title);
if (null != tw) {
// hacking again ... missing a getResultsTable() method in TextWindow
final ResultsTable rt = (ResultsTable) Utils.getField(tw.getTextPanel(), "rt");
// assumes columns will be identical
if (null != rt)
return rt;
}
// else create a new one
final ResultsTable rt = new ResultsTable();
rt.setPrecision(2);
for (int i = 0; i < columns.length; i++) rt.setHeading(i, columns[i]);
//
return rt;
}
}).get();
} catch (final Throwable t) {
IJError.print(t);
return null;
}
}
use of ij.measure.ResultsTable in project mcib3d-core by mcib3d.
the class Association method getAssociationTable.
@Deprecated
public ResultsTable getAssociationTable() {
ResultsTable rt = ResultsTable.getResultsTable();
if (rt == null)
rt = new ResultsTable();
// normal asso
int row = rt.getCounter();
for (String s : CostsOK.keySet()) {
Object3D object3D1 = getObject3D1fromAsso(s);
Object3D object3D2 = getObject3D2fromAsso(s);
rt.setValue("Label1", row, object3D1.getValue());
rt.setValue("Label2", row, object3D2.getValue());
rt.setValue("CostAsso", row, CostsOK.get(s));
row++;
}
// orphan1
row = rt.getCounter();
for (String s : getOrphan1()) {
rt.setValue("Label1", row, s);
rt.setValue("Label2", row, 0);
rt.setValue("CostAsso", row, 0);
row++;
}
// orphan2
row = rt.getCounter();
for (String s : getOrphan2()) {
rt.setValue("Label1", row, 0);
rt.setValue("Label2", row, s);
rt.setValue("CostAsso", row, 0);
row++;
}
return rt;
}
use of ij.measure.ResultsTable in project mcib3d-core by mcib3d.
the class TrackingAssociation method getResultsTableAssociation.
public ResultsTable getResultsTableAssociation() {
if (finalAssociations == null)
computeTracking();
// create results table
ResultsTable table = new ResultsTable();
// list associations
int row = table.getCounter();
for (AssociationPair pair : finalAssociations) {
int val1 = pair.getObject3D1().getValue();
int val2 = pair.getObject3D2().getValue();
double cost = pair.getAsso();
// table
table.setValue("Label1", row, val1);
table.setValue("Label2", row, val2);
table.setValue("Cost", row, cost);
row++;
}
// orphan1
row = table.getCounter();
for (Object3D object3D : finalOrphan1) {
table.setValue("Label1", row, object3D.getValue());
table.setValue("Label2", row, 0);
table.setValue("CostAsso", row, 0);
row++;
}
// orphan2
row = table.getCounter();
for (Object3D object3D : finalOrphan2) {
table.setValue("Label1", row, 0);
table.setValue("Label2", row, object3D.getValue());
table.setValue("CostAsso", row, 0);
row++;
}
return table;
}
use of ij.measure.ResultsTable in project mcib3d-core by mcib3d.
the class TrackingAssociation method getResultsTableMitosis.
public ResultsTable getResultsTableMitosis() {
if (finalAssociations == null)
computeTracking();
// create results table
ResultsTable table = new ResultsTable();
// list associations
int row = table.getCounter();
for (Mitosis mitosis : finalMitosis) {
// table
table.setValue("Mother", row, mitosis.getMother().getValue());
table.setValue("Daughter1", row, mitosis.getDaughter1().getValue());
table.setValue("Daughter2", row, mitosis.getDaughter2().getValue());
table.setValue("Colocalisation", row, mitosis.getColocMitosis());
row++;
}
return table;
}
Aggregations