Posted by
Marcus Jones on
May 24, 2016; 3:42pm
URL: http://imagej.273.s1.nabble.com/Glitch-with-Batch-Processing-tp5016511.html
I'm batch processing pictures using a macro to determine percentage of green plant tissue from small plot research trials. Every so often a picture doesn't appear to process correctly and the coverage estimates are greatly underestimated.
Examples of the original image and the subsequent image that doesn’t process correctly after running through the macro are attached.
When I manually set the color threshold levels, convert to binary, and run the Analyze Particles function, the vast majority of green tissue is properly selected. But for some reason, the plant tissue in the bottom 2/3rds of the picture isn’t correctly selected when run through the macro. This issue is rather sporadic and doesn’t always occur. I’ve ran entire sets of images (50-100) without this occurring.
Here is the code for the macro I’m using:
run("Set Scale...", "distance=3494.5 known=100 unit=cm");
run("Color Threshold...");
// Color Thresholder 1.49m
// Autogenerated macro, single images only!
min=newArray(3);
max=newArray(3);
filter=newArray(3);
a=getTitle();
run("HSB Stack");
run("Convert Stack to Images");
selectWindow("Hue");
rename("0");
selectWindow("Saturation");
rename("1");
selectWindow("Brightness");
rename("2");
min[0]=35;
max[0]=125;
filter[0]="pass";
min[1]=45;
max[1]=255;
filter[1]="pass";
min[2]=0;
max[2]=255;
filter[2]="pass";
for (i=0;i<3;i++){
selectWindow(""+i);
setThreshold(min[i], max[i]);
run("Convert to Mask");
if (filter[i]=="stop") run("Invert");
}
imageCalculator("AND create", "0","1");
imageCalculator("AND create", "Result of 0","2");
for (i=0;i<3;i++){
selectWindow(""+i);
close();
}
selectWindow("Result of 0");
close();
selectWindow("Result of Result of 0");
rename(a);
// Colour Thresholding-------------
run("8-bit");
setAutoThreshold("Default");
//run("Threshold...");
setOption("BlackBackground", false);
run("Convert to Mask"); run("Remove Outliers...", "radius=2 threshold=50 which=Dark");
run("Analyze Particles...", " show=Masks display summarize");
I’ve updated to the most recent version of ImageJ to no avail.
>>Does anyone know why this is happening and is there anything I can do to avoid this?
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html