Search in sources :

Example 21 with ResultsTable

use of ij.measure.ResultsTable in project mcib3d-core by mcib3d.

the class Objects3DPopulationColocalisation method getResultsTableAll.

/**
 * get the results of colocalisation as an ImageJ  Results Table
 *
 * @param useValueObject use the original value of objects
 *                       else use incremental values
 * @return the Results Table
 */
public ResultsTable getResultsTableAll(boolean useValueObject) {
    if (needToComputeColoc)
        computeColocalisation();
    ResultsTable rt = ResultsTable.getResultsTable();
    if (rt == null)
        rt = new ResultsTable();
    rt.reset();
    // temp colum index
    HashMap<String, Integer> colums = new HashMap<>(population2.getNbObjects());
    for (int ia = 0; ia < population1.getNbObjects(); ia++) {
        rt.incrementCounter();
        if (!useValueObject) {
            rt.setLabel("A" + ia, ia);
        } else {
            rt.setLabel("A" + population1.getObject(ia).getValue(), ia);
        }
        for (int ib = 0; ib < population2.getNbObjects(); ib++) {
            int coloc;
            String key = population1.getObject(ia).getValue() + "-" + population2.getObject(ib).getValue();
            if (colocs.containsKey(key))
                coloc = colocs.get(key).getVolumeColoc();
            else
                coloc = 0;
            if (ia == 0) {
                if (!useValueObject) {
                    rt.setValue("B" + ib, ia, coloc);
                    colums.put("B" + ib, rt.getColumnIndex("B" + ib));
                } else {
                    int v2 = population2.getObject(ib).getValue();
                    rt.setValue("B" + v2, ia, coloc);
                    colums.put("B" + v2, rt.getColumnIndex("B" + v2));
                }
            } else {
                if (!useValueObject) {
                    rt.setValue(colums.get("B" + ib), ia, coloc);
                } else {
                    int v2 = population2.getObject(ib).getValue();
                    rt.setValue(colums.get("B" + v2), ia, coloc);
                }
            }
        }
    }
    return rt;
}
Also used : HashMap(java.util.HashMap) ResultsTable(ij.measure.ResultsTable)

Example 22 with ResultsTable

use of ij.measure.ResultsTable in project mcib3d-core by mcib3d.

the class Objects3DPopulationColocalisation method getResultsTableOnlyColoc.

public ResultsTable getResultsTableOnlyColoc(boolean useValueObject) {
    if (needToComputeColoc)
        computeColocalisation();
    IJ.log("Colocalisation completed, building results table");
    ResultsTable rt = ResultsTable.getResultsTable();
    if (rt == null)
        rt = new ResultsTable();
    rt.reset();
    for (int ia = 0; ia < population1.getNbObjects(); ia++) {
        Object3D object1 = population1.getObject(ia);
        rt.incrementCounter();
        if (!useValueObject) {
            rt.setLabel("A" + ia, ia);
        } else {
            rt.setLabel("A" + object1.getValue(), ia);
        }
        ArrayList<PairColocalisation> list = getObject1ColocalisationPairs(object1);
        for (int c = 0; c < list.size(); c++) {
            PairColocalisation colocalisation = list.get(c);
            if (colocalisation.getObject3D1() != object1)
                IJ.log("Pb colocalisation " + object1);
            Object3D object2 = colocalisation.getObject3D2();
            int i2 = population2.getIndexOf(object2);
            if (!useValueObject)
                rt.setValue("O" + (c + 1), ia, i2);
            else
                rt.setValue("O" + (c + 1), ia, object2.getValue());
            rt.setValue("V" + (c + 1), ia, colocalisation.getVolumeColoc());
            rt.setValue("P" + (c + 1), ia, (double) colocalisation.getVolumeColoc() / (double) object1.getVolumePixels());
        }
    }
    return rt;
}
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