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;
}
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;
}
Aggregations