fiji / Colocalisation_Analysis

Fiji's plugin for colocalization analysis
http://imagej.net/Coloc_2
GNU General Public License v3.0
24 stars 18 forks source link

Pearson's correlation from ImageJ2 macro #72

Closed christianrickert closed 3 years ago

christianrickert commented 3 years ago

Is there a way to access the Pearson's correlation calculation from an ImageJ2 macro (macro language)?

The plugin is properly installed and is available to ImageJ2:

QuickSearch

I've tried to call the Pearson' correlation function directly:

// prepare two images to correlate
run("Blobs (25K)");
rename("blobs");

run("Blobs (25K)");
rename("nobs");
run("Add Noise");

// calculate Pearson's correlation
result = call("net.imagej.ops.coloc.pearsons.DefaultPearsons", "blobs", "nobs");

But I get an error message:

error

Any ideas?

ctrueden commented 3 years ago

@christianrickert You can do it by calling the coloc.pearsons op as follows:

#@ Dataset d1
#@ Dataset d2
#@ OpService ops
coeff = ops.coloc().pearsons(d1, d2)
println(coeff)

Note that this is a Groovy script, not an ImageJ1 macro. You cannot call ops easily from the IJ1 macro language.