在imageJ

时间:2015-08-06 16:03:46

标签: image imagej roi

我正在创建一个自动测量荧光强度的脚本。我已经做了一些进展,宏打开图像,分成尽可能多的通道并执行一些转换,以便可以在图像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

由于

1 个答案:

答案 0 :(得分:0)

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

您可以使用Macro Recorder轻松了解更多宏命令。

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

对于更复杂的每ROI分析,您可以使用roiManager("count")roiManager("select", i)命令在管理器中循环ROI。 Scale_All_ROIs宏给出了一个例子;您可以通过打开新脚本(文件&gt;新&gt;脚本)然后从模板&gt;中选择它来轻松地将该宏加载到Script Editor中。 IJ1脚本编辑器的宏菜单。