JACoP plugin throws error in macro

Dear image.sc community,

once again I turn to you for help. I ran into a strange occurrence I can’t explain.

Given a simple RGB color image such as below I want analyze the colocalization of the red and green channel using the JACoP plugin.

When I do the steps manually everything works like a charm, however when I write a macro for it I get the following error:

image

Here is a the core of the macro:

title=getTitle;
thresholds = newArray(70,50);
roiManager("reset");

run("Duplicate...", "title=threshold" );
run("Split Channels");
selectWindow("threshold (blue)");
close();
selectWindow("threshold (green)");
rename("green");
selectWindow("threshold (red)");
rename("red");
run("JACoP ", "imga=[green] imgb=[red] thra="+thresholds[0]+" thrb="+thresholds[1]+" pearson mm");

Any idea of what is wrong/missing in the macro that the plugin throws the error? My version of Fiji doesn’t have a specific “RGB split” function, that’s why I use “split channel”.
Thanks in advance!!

Cheers, Hanna

Hi Hanna,

The code you have given works perfectly well. Could you paste the whole macro (using the </> tool so it’s formatted properly), so we can see a bit further?

Split channel is what you need for RGB. However, if your original file is not RGB but a multichannel 16-bit image, you’re better off using the later.

Sincerely,

Matthieu

Dear MatthieuV,

thanks for the answer! I guess, if the MWE is working on your end that means that the problem is not the macro itself but “my” Fiji / Computer, because the same code that I posted throws me the error.
I will try to run it with an older Fiji I have as a backup, and download a fresh one. Maybe some update in some plugin is messing something up.

In any case, I’ve pasted the the whole macro below (not finished, just to the point when I ran into trouble), it gives me the same error as the MWE.

title=getTitle;
roiManager("reset");
thresholds = newArray(30,40);

selectWindow(title);
run("Duplicate...", "title=CellBody ");
setTool("polygon");
waitForUser("Draw around the cell body");
roiManager("Add");
run("Clear Outside");
run("Split Channels");
selectWindow("CellBody (blue)");
close();
run("JACoP ", "imga=[CellBody (red)] imgb=[CellBody (green)] thra="+thresholds[0]+" thrb="+thresholds[1]+" pearson mm");
selectWindow("CellBody (green)");
close();
selectWindow("CellBody (red)");
close();