Editing the color threshold macro

Hello, I am trying to work with the color threshold macro but most of the lines of code it generates are not things I want it to do.

What I am trying to do is simply run(“Color Threshold…”); at a given min/max hue values (it does this fine), followed by pressing the “select” button to create a ROI mask. I don’t want it to "Invert’ or “Convert Stack to Images”.

My aim here is shown in the screenshot below where I take my original image (left) run color threshold with the parameters as shown (center) and press the “Select” button to create a ROI of the thresholded areas (right).

I feel like my code should start off something like this:

run("Color Threshold...");
min["Hue"]=50;
max["Hue"]=105;
filter["Hue"]="pass";

but so far no luck. Hopefully someone can point me in the right direction. Thanks.

It looks like that was originally a fluorescent image (now RGB). You may want to treat it as a fluorescent image and split the colors, then use a basic mono threshold. In general, it is better to keep the channels separated for analysis. It specifically gets worse if the images are made RGB AND encoded as JPG, as that starts merging the colors together in an unrecoverable manner (JPEG encoding is not done in RGB space).

1 Like

Agreed, and normally I do exactly that. Also the images are tif (sorry that image was a screenshot, not the original).

Slight tangent: The reason I am doing a color threshold is because sometimes the elastin filaments (red wavy lines in original image) sometimes have an orangy color to them (don’t know why, probably something from when the images were acquired). This results in the elastin showing up in the green channel (it should only show up in red). This is a big problem for when I do the color split and try to analyze the green channel. So my solution was to do a color threshold, which is not ideal, but it allows me to only select green, and ignore the signal I get from orange.

Back to original problem: is there a macro that can open the color threshold at the specified settings but not do all the other stuff to change the image? Thanks.