Hello!
I am attempting to write a two-part macro and am having difficulties getting it to transition from part one to part two. I’m sure this is quite simple to those of you who have computer skills and i would greatly appreciate your instruction.
Part 1: Set color threshold HSB parameters to find total area of blackberry fruit and Analyze Particles!
Part 2: Adjust parameters to find area of drupelets that are red to purple and Analyze Particles!
In this latest code, the original image is restored between part 1 and part 2. The error message that usually comes up is the Converter—supported conversions window.
All in all, looking at a picture of blackberries, i want to find the ratio of red drupelets to total drupelets.
Any help or suggestions are welcome!
Thanks,
Bethany
Below is one of my many attempts:
run("Color Threshold...");
// Color Thresholder 1.50i
// 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]=5;
max[1]=255;
filter[1]="pass";
min[2]=0;
max[2]=205;
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...", "include summarize");
run("RGB Color");
// Color Thresholder 1.50i
// 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]=5;
max[1]=255;
filter[1]="pass";
min[2]=0;
max[2]=205;
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-------------
// Color Thresholder 1.50i
// 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]=5;
max[0]=235;
filter[0]="stop";
min[1]=5;
max[1]=255;
filter[1]="pass";
min[2]=0;
max[2]=205;
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...", "include summarize");
run("RGB Color");