Re: Macro Problem : Process files from subfolder
Posted by
Jan Eglinger on
Apr 25, 2015; 8:39pm
URL: http://imagej.273.s1.nabble.com/Macro-Problem-Process-files-from-subfolder-tp5012610p5012612.html
Hi Pierre,
Fiji's script editor [1] contains a template for exactly that purpose:
applying a macro recursively on all files in a folder and in all
subfolders. You find it in the editor's menu:
Templates > IJ1 Macro > Process Folder
In case you are using plain ImageJ 1.x, you can copy and paste the
template code from here:
https://github.com/imagej/imagej-legacy/blob/master/src/main/resources/script_templates/IJ1_Macro/Process_Folder.ijmHope that helps,
Jan
[1]:
http://fiji.sc/Using_the_Script_EditorOn 25.04.15 21:15, chloroplaster wrote:
> 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();
> }
> }
>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html