Need help creating an ImageJ Loop

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Need help creating an ImageJ Loop

Kerills
Hi!  I am new to using imageJ and creating my own codes, anyways, I am trying to create a loop that runs all the roi's at once, but I am having trouble doing that. So far this is the code I have:

input = "S:\\Research Projects\\BAC\\machine training set\\Results_1stRound\\2016Data_1stRound\\epoch_based_training_0.7_TPF=0.615_FP=2.110\\SID130871_9999.330357336093230241152104825447607218951\\";
output = input;

function action(input, output, filename) {
open(input + filename);
setThreshold(112, 255);
run("Create Selection");

roiManager("Add");
roiManager("Select", 0);
saveAs("selection", output + filename);
close();
roiManager("Deselect");
roiManager("Delete");
}

list = getFileList(input);
for (i = 0; i < list.length; i++)
        action(input, output, list[i]);

What I want the loop to do is to look through all the different SID files that I have so I wouldn't need the specific SID part in the input but I have no idea how to create a loop so that it looks through folders and subfolders to create the rois. Any help on how I can accomplish this would be great.