Login  Register

Re: Macro Problem : Process files from subfolder

Posted by chloroplaster on Apr 25, 2015; 7:15pm
URL: http://imagej.273.s1.nabble.com/Macro-Problem-Process-files-from-subfolder-tp5012610p5012611.html

Hi Again, I resolved but only partially the problem
My main folder has 3 folders, but my code only process 2 of the subfolders

Thanks for your help !!! :)
______________________
Here is my new code

dir1=getDirectory('');
list1= getFileList (dir1);
        for (i=0; i<(list1.length+1); i++)
        {
                dir2 = dir1+list1[i];
                list2 = getFileList (dir2);
                        for (j=0; j<list2.length; j++)
                                {
                                open (dir2+list2[j]);
                                run("Split Channels");
                                setAutoThreshold("Default dark");
                                //run("Threshold...");
                                setThreshold(30000, 65535);
                                run("Analyze Particles...", "size=1-20 circularity=0.10-1.00 show=[Overlay Masks] summarize in_situ");
                                close();
                                run("Measure");
                                run("Gaussian Blur...", "sigma=5");
                                setAutoThreshold("Default dark");
                                //run("Threshold...");
                                setThreshold(9000, 34290);
                                run("Analyze Particles...", "size=50-Infinity show=[Overlay Masks] summarize in_situ");
                                close();
                                close();
                                setAutoThreshold("Default dark");
                                //run("Threshold...");
                                setThreshold(5700, 65535);
                                run("Analyze Particles...", "size=50-Infinity show=[Overlay Masks] summarize in_situ slice");
                                close();
                                }
        }