Posted by
Gabriel Landini on
Dec 03, 2014; 9:40am
URL: http://imagej.273.s1.nabble.com/IJ-Color-Thresholding-in-Macro-tp5010727p5010736.html
On Tuesday 02 Dec 2014 15:21:47 Steve R wrote:
> when recording a Macro, I do a Color Threshold, and hit the Macro button to
> send the threshold settings into the macro, it also adds a bunch of routines
> that I don't want, like HSB Stack & some other stuff that ends up making
> the resultant image completely white except for the thresholded voids.
I wrote the routine that generates the macro code, so I might be able to help
here. The colour threshold procedure converts a colour image to binary (black
and white), so the macro generated is doing what it is supposed to do and
needs all that code. If the image were leaving other colours, it would not be
a thresholded image. What you want to is masking some colour combinations set
with the sliders.
> This
> makes it hard to see if it picked the void area correctly without seeing
> the image in the background. If I Color Threshold manually & then manually
> do a analyze Particles, I can pick Outline Overlay as an option & get what
> I want.
I understand the problem, but there is no automatic way of doing this.
> Is there not a way to record in the Macro just the Color Threshold Settings
> as if I were doing it manually?
Unfortunately not, but you can easily do this: if the "white is the part where
you want to see the original colours (and the rest black) then you can do an
AND operation between the original and the binary image. If it is the "black"
part where you want to see the colours, then invert the binary image and then
apply the AND operation with the original.
Hope this helps.
Gabriel
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html