Re: YUV thresholding in a macro
Posted by asuspeg on Mar 20, 2016; 11:09pm
URL: http://imagej.273.s1.nabble.com/YUV-thresholding-in-a-macro-tp5015832p5015957.html
Hi Stefan,
Thank you very much for your answer.
Unfortunately, the specimens I follow are not the same... So after posting my message, I have continued to search for solutions and I found something easier :
There is no other color in my photos apart of my cells, so I just did a threshold by saturation : with "color threshold", I simply set up the "saturation" to a fixed value and take all the "hue" and "brightness" spectre. And it works very well !
So thank you anyway for your macro, maybe it will help me for following future cultures.
I post my macro if someone is intrested :
run("Color Threshold...");
// Color Thresholder 1.49v
// 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]=0;
max[0]=255;
filter[0]="pass";
min[1]=100;
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("Analyze Particles...", "size=500-Infinity summarize");