在 imageJ 中测量多个 ROI

Measure multiple ROIs in imageJ

我正在创建一个用于自动测量荧光强度的脚本。我已经取得了一些进展,宏打开了图像,分成尽可能多的通道并执行一些转换,以便可以在图像 1 上执行粒子分析。然后,我想要的是测量所有创建的 ROI,但是我此时堆积:

这是我的代码

 dir1 = getDirectory("Choose Source Directory ");
  list = getFileList(dir1);                                                           // get the list of all filenames in the directory
  subst = 3;                                                                          // set the "subst" variable to 3
  Dialog.create("BatchSplitStacks");                                                  // create a dialogue to change the stack divisor
  Dialog.addNumber("Number of substacks:", subst);                                    // in the dialogue, get the number of substacks, default is "subst" (=3)
  Dialog.show();                                                                      // show the above created dialogue
  chan = Dialog.getNumber();                                                          // the stack divisor is defined
  setBatchMode(false);                                                                 // do not show the images while processing them
  for (i=0; i<list.length; i++) {                                                     // go through the files of the folder
      showProgress(i+1, list.length);                                                 // the progress of the processing of the actual stack is shown in the ImageJ window
      open(dir1+list[i]);                                                             // open an original stack
      name = list[i];                                                                 // get the filename of the original stack
      run("Stack Splitter", "number="+chan);                                          // run the Stack Splitter plugin with the defined divisor
      for (e=0; e<chan; e++) {                                                        // for each substack a saving routine is run
         dotIndex = lastIndexOf(name, ".");                                           // this line and the following line I took from another macro but I do not know 
                                                                          // substacks with a number below 10 are saved with a suffix and a 2 digit extension (e.g. 01 instead of the standard 1)
             saveAs("tiff", dir1+"c0"+e+".tif");
          close();
                                                                          // closing substack
      }                                                                               // next saving routine
                     close();                                                                   // closing current original stack

                     open(dir1+"c02.tif");
                                run("Enhance Contrast", "saturated=0.35");
                                run("Enhance Contrast", "saturated=0.35");
                                run("Enhance Contrast", "saturated=0.35");
                                setAutoThreshold("Default");
                                setAutoThreshold("Default dark");
                                run("Make Binary");
                                run("Make Binary");
                                run("Watershed");
                                run("Analyze Particles...", "size=0.30-50.00 circularity=0.00-0.70 show=Masks display summarize add in_situ");
                     open(dir1+"c01.tif");
                     run("Subtract Background...", "rolling=50");


        saveAs("Results", dir1+name+"c02"+ ".txt");
  }                                                                                   // move on to next original stack in the folder

谢谢

您可以使用“测量”按钮测量 ROI Manager 中的所有 ROI。在宏中,行是: roiManager("Deselect"); roiManager("Measure");

您可以通过Macro Recorder.

轻松学习更多宏命令

您可以在线浏览所有可用的macro functions

对于更复杂的每个 ROI 分析,您可以使用 roiManager("count")roiManager("select", i) 命令循环管理器中的 ROI。 Scale_All_ROIs macro gives an example of this; you can easily load that macro into the Script Editor 打开一个新脚本(文件 > 新建 > 脚本),然后从脚本编辑器的模板 > IJ1 宏菜单中选择它。