I have the following macro (below) to analyze a batch of images in a folder.
Initially, I was using a higher magnification and tissues filled the field
of view. Now I'm using a lower magnification and need to select the tissue
in the field of view before thresholding and doing the analysis. The wand
tool works well (50% tolerance) to quickly select tissue.
What I would like is for an additional step to this macro to allow me to use
the wand tool to select the tissue before converting to 8 bit and
thresholding. Such as
1)ask for folder (choose directory)
2)open image from folder
3)allow the operator use the wand tool (waitforuser)
4)8-bit
5)threshold (waitforuser)
6)analyze particles
7)store results
8)continue loop until all images have been processed
Can someone help by adapting this macro script to accomplish this? I added a
sample image at the end.
macro "mac agg" {dir = getDirectory("Choose Source Directory");
list = getFileList(dir);
for (i=0; i<list.length; i++) {
open(dir+list[i]);
run("8-bit");
setAutoThreshold("Default");
run("Threshold...");
waitForUser("Adjust threshold, then click 'OK' ");
run("Analyze Particles...", "size=50-Infinity display
exclude include summarize");
run("Set Measurements...", "area mean min
display");close();}
if (nResults != 0){
for (i=0; i<nResults; i++){
resLabel = getResultLabel(i);
if (indexOf(resLabel, ".tif") > 0) {
resLabel = substring (resLabel, 0,
lastIndexOf(resLabel,".tif")); // remove the ".tif" in the text string
n = lengthOf(resLabel); // number of characters in
the text string
LBL = substring (resLabel, 0, n-2); // remove the
last 2 characters to get the label
section = substring (resLabel, n-1, n); // remove
all text in label except last character
setResult("Label", i, LBL); // set the text string
for new label
setResult("Section", i, section); // set the text
string for section
}
} } else {
showMessage("No Result found in result table");
}
selectWindow("Results");
saveAs("Measurements", "C:\\Documents and
Settings\\jshaner\\Desktop\\test.xls");
close();close();close();
};
<
http://imagej.1557.x6.nabble.com/file/t380219/16wp318_sm.jpg>
--
Sent from:
http://imagej.1557.x6.nabble.com/--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html