Hi Colin,
instead of RGB stacked, prefer split components.
When you use a threshold, you split the image in two components : the objects of interest (generally in white 255) and the remaining part (generally in black 0). You have a binary image, so it’s normal that you can’t distinguish the coral anymore. this binary image can be used as a mask on the original image to select your object of interest.
You can use the thresholding sliders to perform a manual thresholding. If you find a hard threshold that is ok for every image, it’s ok. But if you have to manually adapt the threshold to every image, you MUST NOT (:)) use it, because you introduce a bias (the choosen threshold will depend on your mood of the day, on your tired…). If your threshold moves, you have to use an automatic adaptative threshold (there is a full list in imageJ).
The macro below should answer some of your questions.
nameImg = "P7230105.JPG";
selectImage(nameImg);
run("Split Channels"); //you separate the channels
selectImage(nameImg + " (green)"); close();
selectImage(nameImg + " (blue)");
// first you have to select the tile
run("Duplicate...", "title=tile");
setAutoThreshold("Triangle"); //this is done wih an automatic threshold ; the Triangle
setOption("BlackBackground", true);
run("Convert to Mask");
//you remove small artifacts
run("Analyze Particles...", "size=0-10000 exclude clear add");
setForegroundColor(0, 0, 0);
roiManager("Fill");
// you fill holes inside the tile and then perform a big opening to remove artifacts linked to the tile
run("Fill Holes");
run("Options...", "iterations=30 count=1 black do=Nothing");
run("Open");
// then you select the only object remaining. if there are severall objects, you have to select the biggest
run("Analyze Particles...", "size=10000 exclude clear add");
roiManager("Select", 0);
// and you apply this selection to the blue componenent
selectImage(nameImg + " (blue)");
run("Restore Selection");
//and segment automaticaly the coral
setAutoThreshold("Huang");
run("Convert to Mask");
//and remove small artifacts
run("Analyze Particles...", "size=0-5000 exclude clear add");
roiManager("Fill");
selectImage("tile"); close();
// the biggest object remaining should be your coral
if you fell that the biggest object is not ok, you may use the mean red value of each objet.
run("Set Measurements...", "area mean redirect=[" + nameImg + " (red)] decimal=2");
run("Analyze Particles...", "size=[] display exclude clear add");
for example on image P7230105, you see that the mean grey value of coral (~75) is very different from algae (~115), so this may help to automatically discriminate them.
Nico