Set color threshold

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Set color threshold

davek604
Hello
I am writing a plugin where I have an image that has been constructed from 2 binary masks. The masks were coloured green (000,255,00) and red (255,000,000) so where there is overlap I get yellow (255,255,000) I want to automatically set the RGB threshold to select the yellow but I can find no command in the API for doing this on colour images. For grey scale I use the command IJ.setThreshold(imp,lowThresholdValue,HighThresholdValue)
Unfortunately I can't find a colour version of this command. Any help greatly appreciated.

Regards

David
Reply | Threaded
Open this post in threaded view
|

Re: Set color threshold

Peter Haub
Hi David,

there is no such command for color images in ImageJ. Thresholding color
images is more complex.

In your situation (Task: select value 255/255/0 where others can only be
0/255/0 or 255/0/0) I would prefer to create a gray scale image and work
on this.
Use
         ImageProcessor ip2 = imp.getProcessor().convertToByteProcessor();
         ImagePlus imp2 = new ImagePlus("Gray", ip2);
to create a 8bit image with the weights wR/wG/wB = 1/1/1.

Regards,
Peter

On 05.11.2015 11:32, davek604 wrote:

> Hello
> I am writing a plugin where I have an image that has been constructed from 2
> binary masks. The masks were coloured green (000,255,00) and red
> (255,000,000) so where there is overlap I get yellow (255,255,000) I want to
> automatically set the RGB threshold to select the yellow but I can find no
> command in the API for doing this on colour images. For grey scale I use the
> command IJ.setThreshold(imp,lowThresholdValue,HighThresholdValue)
> Unfortunately I can't find a colour version of this command. Any help
> greatly appreciated.
>
> Regards
>
> David
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Set-color-threshold-tp5014850.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Set color threshold

davek604
Hello Peter

I thought that might be the case, I've been rewriting my code similar to how you suggested. It would have been quicker if I could have used colour but I've figured out a greyscale way to achieve what I wanted.
Thanks for the response

David