I am currently trying to make a script to recursively create Z-stack on images in subfolders. I have my main folder that contains subfolders (different animals) each of this subfolders contain 3 subfolders of 3 differen channels. I need to Z-stack by channel so I need 2 loops: 1)for each folder in main folder 2)for each channel subfolder.
I need that because the stack need to be done by animal and by channel of the animal.
Summary of the needed loop
1)Load image series, divided by subfolder of each animal’s folder
For all the image in the animal subfolder (for ex. channel one) run(“Z Project…”, “projection=[Max Intensity]”);
save the output in the same folder with the name +“processed” (TIF format)
I am trying since forever but I can’t program in Java and with Python I can’t make work the extension import so that’s not an option. My main issue is: I define “path” the path of my main folder, inside path I have other folders and inside that folders I have 3 subfolders (one for each channel) and THEN I have the files… so it’s really complicated for me to think about the loop like this.
I don’t know if it helps but in python I did it like this but no idea about how to translate it in Java!
root = “MAIN DIRECTORY PATH”
path = os.path.join(root, “.”)
for path, subdirs, files in os.walk(root):
for sub_files in files: