Posted by
Jan Eglinger on
URL: http://imagej.273.s1.nabble.com/Image-Thresholding-for-Binary-workflow-tp5007850p5007872.html
Hi Rainer,
On 23.05.2014, 12:15 PM, Rainer M. Engel wrote:
> Am 22.05.2014 12:08, schrieb John Hayes:
>> Check out the ByteProcessor::threshold function:
>> Sets pixels less than or equal to level to 0 and all other pixels to 255.
You should not need to dive into low-level API programming to perform
thresholding and binarization.
>> Le 22 mai 2014 à 11:23, Rainer M. Engel a écrit :
>>
>>> I'm looking for way to threshold an image and in the same process making
>>> it binary.
The macro recorder (Plugins > Macros > Record...) records the following
when clicking "Apply" in the threshold window:
setAutoThreshold("Default dark");
setOption("BlackBackground", true);
run("Convert to Mask");
>>>
>>> Process > Binary > Make Binary
>>> sometimes caused plausible black/white dominance switches.
I guess you mean inconsisten results dependent on whether "Black
background" is activated in Process > Binary > Options... (see
http://imagej.nih.gov/ij/docs/guide/146-29.html#infobox:blackBackground
for documentation)
setOption("BlackBackground", true);
>>>
>>> Process > Math > Macro
>>> works better for my purposes (i.e.| if (v<=25) v=0; else v=255)
>>>
>>> The later Expression is very slow compared even to an Gaussian Blur or
>>> similar. Are there other, hopefully faster ways (for high resolution) to
>>> threshold and make binary (8bit)?
>>>
>>> I tried ..
>>> setMinAndMax(173, 173);
>>> .. but this does no clamping like I thought it might..
You probably want to use something like
setThreshold(0, 173);
to set the Threshold to a specified value.
Hope that helps,
Jan
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html