ROI manager data exported as a .xls file from a directory batch processing

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

ROI manager data exported as a .xls file from a directory batch processing

JanJaapBurggraaf
Dear Forum users,

I'm relatively new to ImageJ, but I have encountered a problem that is not yet solved on this forum.
What I'm trying to do is the following:

There are regions on the images I want to process which are more fluorescent than others (black+white). All images are in .png. What I'm trying to do, is to manually adjust the threshold of the image, create a selection around the fluorescent spots, split the selection in the ROI manager, measure the selection and export these measurements to an excel file. This works for me, but just on 1 image. Now I've tried to get this to work on a batch, but this is too hard for me. I've tried using exact template given in the Fiji batch processing template. Could someone help me?

Kind Regards,
Jan Jaap Burggraaf
The Netherlands

Below the code I use:

input = getDirectory("Input Directory");
output = getDirectory("Output Directory");

Dialog.create("File type");
Dialog.addString("File suffix: ", ".xls", 5);
Dialog.show();
suffix = Dialog.getString();

processFolder(input);

function processFolder(input) {
list = getFileList(input);
for (i = 0; i < list.length; i++) {
if(File.isDirectory(input + list[i]))
processFolder("" + input + list[i]);
if(endsWith(list[i], suffix))
processFile(input, output, list[i]);
}
}

function processFile(input, output, file) {
run("Threshold...");
setAutoThreshold("Huang dark");
setThreshold(6972, 13988);

run("Create Selection");

run("ROI Manager...");
roiManager("Split");

run("Select All");
roiManager("Measure");

saveAs ("M:\2b. Clinical results\SNR vs TBR\Signal-to-Noise Ratio\Resultaten Muizen N1\)

}