Search in sources :

Example 16 with ResultsTable

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);
}
Also used : HashMap(java.util.HashMap) ResultsTable(ij.measure.ResultsTable)

Example 17 with ResultsTable

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;
    }
}
Also used : TextWindow(ij.text.TextWindow) ResultsTable(ij.measure.ResultsTable) Callable(java.util.concurrent.Callable)

Example 18 with ResultsTable

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;
}
Also used : ResultsTable(ij.measure.ResultsTable) Object3D(mcib3d.geom.Object3D)

Example 19 with ResultsTable

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;
}
Also used : ResultsTable(ij.measure.ResultsTable) Object3D(mcib3d.geom.Object3D)

Example 20 with ResultsTable

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;
}
Also used : ResultsTable(ij.measure.ResultsTable)

Aggregations

ResultsTable (ij.measure.ResultsTable)22 HashMap (java.util.HashMap)3 Calibration (ij.measure.Calibration)2 Object3D (mcib3d.geom.Object3D)2 ImagePlus (ij.ImagePlus)1 GenericDialog (ij.gui.GenericDialog)1 Roi (ij.gui.Roi)1 Analyzer (ij.plugin.filter.Analyzer)1 TextWindow (ij.text.TextWindow)1 Project (ini.trakem2.Project)1 AreaContainer (ini.trakem2.display.AreaContainer)1 Displayable (ini.trakem2.display.Displayable)1 Profile (ini.trakem2.display.Profile)1 ZDisplayable (ini.trakem2.display.ZDisplayable)1 ProjectThing (ini.trakem2.tree.ProjectThing)1 ProjectTree (ini.trakem2.tree.ProjectTree)1 Menu (java.awt.Menu)1 Point (java.awt.Point)1 Rectangle (java.awt.Rectangle)1 ActionEvent (java.awt.event.ActionEvent)1