2017-09-15 103 views
0

我對imageJ中的批量圖像處理非常新穎。我有一個宏,它允許我在一個目錄中處理多個圖像。問題在於宏爲每個處理後的圖像生成一個單獨的摘要窗口,讓我手動將所有輸出數據編譯爲一個.csv或.xls。我寧願將所有彙總數據自動編譯爲一個文件。雖然我發現有幾個來源顯示如何做到這一點,但在我的情況下,它並沒有特別有用。如何保存多個彙總文件批處理宏imageJ

如果你能幫忙,我會非常感激。

下面是代碼的縮寫例如:

 dir1 = getDirectory("Choose Source Directory "); 
     dir2 = getDirectory("Choose Destination directory"); 
     list = getFileList(dir1); 

     setBatchMode(true); 

     for (i=0; i<list.length; i++){ 
     print (list[i]); 
     open(dir1+list[i]); 
     name=File.nameWithoutExtension; 
     //Prepare the image by removing any scale and making 8-bit 
     run("Set Scale...", "distance=237.3933 known=1 pixel=1 unit=cm 
     global");    

     makeRectangle(4068, 5940, 1572, 1320); 
     run("Crop"); 
     // Convert the image into RGB channels for proper thresholding 
     run("RGB Stack"); 
     setSlice(3); 
     //Threshold 
     setAutoThreshold("Default"); 
     // Analyze particles 
     // Provides total area of number of cotyledons in image 
     run("Analyze Particles...", "size=60-Infinity pixel display include 
     summarize"); 
     run("Revert"); 
} 
//Save the results 
selectWindow("Summary"); 
saveAs("Results", dir2+"Results.xls"); 

回答

0

在我的測試(用ImageJ的2.0.0-RC-61上的MacOS 10.12.6/1.51n),反覆執行與總結分析顆粒選項選中後將摘要添加到現有摘要窗口中,最後可將其保存爲單個文件。

例如,下面的宏產生兩個摘要線,然後將它們保存:

setBatchMode(true); 
run("Blobs (25K)"); 
setAutoThreshold("Default"); 
run("Analyze Particles...", "size=60-Infinity pixel display include summarize"); 
run("Boats (356K)"); 
setAutoThreshold("Default"); 
run("Analyze Particles...", "size=60-Infinity pixel display include summarize"); 
selectWindow("Summary"); 
saveAs("Results", "/Users/curtis/Desktop/Results.xls"); 
相關問題