Coloc_2: return analysis results data structure
For our shiny new colocalisation method signature, which has not yet
been released and hence for which we can still change the signature,
let's return a nice data structure which houses all the results.
Previously, data extraction could be accomplished with a Groovy script:
import ij.IJ import ij.WindowManager IJ.run("Close All"); boats = IJ.openImage("https://imagej.net/images/boats.gif") boats.show() bridge = IJ.openImage("https://imagej.net/images/bridge.gif") bridge.show() IJ.run("Coloc 2", "channel_1=bridge.gif channel_2=boats.gif roi_or_mask=<None> threshold_regression=Costes li_histogram_channel_1 li_histogram_channel_2 li_icq spearman's_rank_correlation manders'_correlation kendall's_tau_rank_correlation 2d_instensity_histogram costes'_significance_test psf=3 costes_randomisations=10") for (f in java.awt.Frame.getFrames()) { if (f instanceof results.SingleWindowDisplay) { for (v in f.valueResults) {
println(v.name + " = " + (v.isNumber ? v.number : v.value))
} } }
But unfortunately, SingleWindowDisplay extends java.awt.Window and thus
cannot be used headless. Plus, the valueResults field is not public.
So now it is possible to call colocalisation programmatically and do
something with the results in a much cleaner fashion, without scraping
the ImageJ1 Log window, and without extracting data as above.
Still won't work headless though, since a SingleWindowDisplay instance
gets instantiated regardless. We'll fix that next!
See also: