2015-08-06 3 views
0

Я создаю скрипт для автоматической измерения интенсивности флуоресценции. Я сделал некоторый прогресс, макрос открывает изображение, разбивается на столько каналов, сколько у меня есть, и выполняю некоторую трансформацию, чтобы можно было выполнить анализ частиц на изображении 1. Затем я хочу измерить все созданные ROI, но Я укладываются в этот момент:Измерение нескольких ROI в imageJ

вот мой код

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 

Благодаря

ответ

0

Вы можете измерить все трансформирования в ROI Manager, используя кнопку Measure. В макросе это строки: roiManager("Deselect"); roiManager("Measure");

Вы можете легко узнать больше макрокоманд с помощью Macro Recorder.

Вы можете просмотреть все доступные macro functions онлайн.

Для более сложного анализа с точки зрения ROI вы можете перебирать ROI в менеджере с помощью команд и roiManager("select", i). В качестве примера можно привести макрос Scale_All_ROIs; вы можете легко загрузить этот макрос в Script Editor, открыв новый скрипт (Файл> Создать> Скрипт), а затем выбрав его из меню Матрицы Шаблонов> IJ1 редактора сценариев.

Смежные вопросы