Colocalization Analysis Macro Problem

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Colocalization Analysis Macro Problem

This post has NOT been accepted by the mailing list yet.
Hello all,

I am an ImageJ macro newbie, but am trying my best to figure things out. Essentially, I am trying to write a macro which uses the "Colocalization" plugin to check the colocalization of my images, and then perform further analysis like Analyze Particles. The problem is that in the parameters of the "Colocalization" plugin, I have to write which images to choose as the two ones being analyzed. So far I wrote:
           run("Colocalization ",  "channel_1=[(imageTitle + " (red)")] channel_2=[(imageTitle + " (green)")]
           ratio=50 threshold_channel_1=50 threshold_channel_2=50 display=255") ;

However, the parameters for the Colocalization plugin are in "quotations", but I also need to put "(red)"and (green) in quotations.

So I am getting an error message which says unexpected (') in this line.

Any way that I can fix this problem? Thanks so much!!

Total code below:

// "BatchProcessFolders"
// This macro batch processes all the files in a folder and any
// subfolders in that folder. In this example, it runs the Subtract
// Background command of TIFF files. For other kinds of processing,
// edit the processFile() function at the end of this macro.

   dir = getDirectory("Choose a Directory ");
   count = 0;
   n = 0;
   //print(count+" files processed");
   function countFiles(dir) {
      list = getFileList(dir);
      for (i=0; i<list.length; i++) {
          if (endsWith(list[i], "/"))

   function processFiles(dir) {
      list = getFileList(dir);
      for (i=0; i<list.length; i++) {
          if (endsWith(list[i], "/"))
          else {
             showProgress(n++, count);
             path = dir+list[i];

  function processFile(path) {
       if (endsWith(path, ".tif")) {
        run("Split Channels");
        run("Colocalization ",  "channel_1=[imageTitle + "(red)"] channel_2=[imageTitle + '(green)'] ratio=50 threshold_channel_1=50 threshold_channel_2=50 display=255") ;
        run("Split Channels");
        setAutoThreshold("Default dark");
        setAutoThreshold("Otsu dark");
        setOption("BlackBackground", false);
        run("Convert to Mask", "method=Otsu background=Dark calculate");
        run("Analyze Particles...", "size=10-1000 show=Nothing summarize stack");
        run("Analyze Particles...", "size=10-1000 show=Nothing summarize stack");