Posted by
jerryk on
Oct 01, 2019; 9:04pm
URL: http://imagej.273.s1.nabble.com/How-do-I-specify-settings-when-running-Color-Threshold-in-ImageJ-Macro-tp5022477.html
How can I run Image > Adjust > Color threshold... using specific settings
such as:
Threshold color = white
Color space = HSB
For the Hue, Saturation, Brightness sliders, how do I specify their values ?
I have folders containing five .tif images that I want to apply color
threshold with the same specific values for hue, saturation, brightness,
threshold color, color space etc... for all of them.
My code currently (I am a beginner to ImageJ macros by the way):
dir = getDirectory("");
images = getFileList(dir);
setBatchMode(true);
for (i = 0; i < images.length; i++) {
open(dir+images[i]);
imgName = getTitle();
run("Color Threshold...");
selectImage(imgName);
run("Measure");
}
run("Summarize");
Also, is there a way that I can calculate the standard deviation and mean of
the Hue, Saturation, Brightness distributions for all pixels in the original
image?
For example, in Python I used the opencv2 module to convert an image to a
numpy array. I iterated through each pixel and found the standard deviation
of the values for Hue, Saturation, Brightness. I would like to use this
standard deviation as a range for my color threshold. I would like to do
this in ImageJ Macro, since I don't know how to transmit data from python
scripts to ImageJ macros.
This is an example of what I want to do:
run("Color Threshold...",
"Hue = [meanHue - stdHue, meanHue + stdHue]",
"Saturation = [meanSaturation - stdSaturation, meanSaturation +
stdSaturation]",
"Brightness = [meanBrightness - stdBrightness, meanBrightness +
stdBrightness]"
)
Maybe it's not implemented this way but I would like to know how.
Any help would be greatly appreciated. Thanks.
--
Sent from:
http://imagej.1557.x6.nabble.com/--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html