Hello to all,
I wrote a macro, analysing all images in a folder. The macro works well but I have two questions refering to the ResultTable: 1. I wrote the macro with IJvers1.42q and get only the results for the second analysis (as expected). Using an newer version (1.43o) I get the results of both analysis, although this is not stated in the macro. What makes this difference? 2. The results for each image are added to the next free row. Is there any way for adding the results to the next free column? Thanks a lot Harald This is the macro: dir1 = getDirectory("Choose Source Directory "); dir2 = getDirectory("Choose Destination Directory "); list = getFileList(dir1); setBatchMode(true); run("Set Measurements...", "area display redirect=None decimal=9"); for (i=0; i<list.length; i++) { showProgress(i+1, list.length); open(dir1+list[i]); run("Auto Threshold", "method=Otsu white"); run("Invert"); run("Analyze Particles...", "size=20-? circularity=0.00-1.00 show=Masks exclude"); run("Skeletonize"); run("Analyze Particles...", "size=0-? circularity=0.00-1.00 show=Nothing display"); saveAs("tif", dir2+list[i]); close(); close(); } selectWindow("Results"); saveAs("Measurements", dir2 + "Results.xls"); run("Clear Results"); run("Close"); |
Hi Harald,
hmmm, I can't reproduce your problem. With ImageJ 1.43q, I also tried most of your macro (without saving; using the built-in setAutoThreshold command and replacing the unreadable character in the 'size' field by 'infinity'). It did not print any results of the first 'Analyze Particles' to the Results Table. All results were from "Mask of..." files. The macro produces an error message if the first 'Analyze Particles' finds no particles (no mask created), but this is expected. Concerning your second question (different columns for different files): I am not aware of any out-of-the-box solution for this. You could do it by writing a macro for this. One point to consider when doing this: The columns will have different length. A Results Table cannot have empty cells, so everything below the actual values of a given image (given column) will be be zero, not empty. Michael ________________________________________________________________ On 4 Mar 2010, at 07:44, Schmidt, Dr. Harald wrote: > Hello to all, > I wrote a macro, analysing all images in a folder. The macro works > well but I have two questions refering to the ResultTable: > 1. I wrote the macro with IJvers1.42q and get only the results for > the second analysis (as expected). Using an newer version (1.43o) I > get the results of both analysis, although this is not stated in > the macro. What makes this difference? > 2. The results for each image are added to the next free row. Is > there any way for adding the results to the next free column? > Thanks a lot > Harald > > This is the macro: > dir1 = getDirectory("Choose Source Directory "); > dir2 = getDirectory("Choose Destination Directory "); > list = getFileList(dir1); > setBatchMode(true); > run("Set Measurements...", "area display redirect=None decimal=9"); > for (i=0; i<list.length; i++) { > showProgress(i+1, list.length); > open(dir1+list[i]); > run("Auto Threshold", "method=Otsu white"); > run("Invert"); > run("Analyze Particles...", "size=20-? circularity=0.00-1.00 > show=Masks exclude"); > run("Skeletonize"); > run("Analyze Particles...", "size=0-? circularity=0.00-1.00 > show=Nothing display"); > saveAs("tif", dir2+list[i]); > close(); > close(); > } > selectWindow("Results"); > saveAs("Measurements", dir2 + "Results.xls"); > run("Clear Results"); > run("Close"); |
Hi Michael,
thanks for your help! its actually a problem of saving the result table. Reducing the analysis to run("Analyze Particles...", "size=20-infinity circularity=0.00-1.00 show=Masks exclude"); run("Skeletonize"); run("Analyze Particles...", "size=0-infinity circularity=0.00-1.00 show=Nothing display"); only the results of the second analysis are visible in the window on the screen, but both analysis are visible after saving (1.43q, different from Vers.1.42) Is it possible to save only the results of the second analysis without using the older Version? Harald |
Free forum by Nabble | Edit this page |