Analyzing hue after threshold on brightness

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

Analyzing hue after threshold on brightness

pepe86
Dear community,
I have not much experience with ImageJ yet, but I am sure that some of you can solve my problem within a few minutes.

I have an image of which I need to get the frequency of different hues, but first I want to remove pixels with low brighness (background). So the aim is to get a list of hue values of an image after applying a threshold on the brightness of the pixels. Preferably using a Macro.

My idea was to split the imge in HSB, set the threshold on the brightness channel, use the selection as a ROI, go back to the hue channel and export the list of values from the histogram.

The problem I am facing is that the threshold that I set in the brightness channel is also appearing in the hue channel, which means that also the hue histogramm is thresholded, not only brightness.

So my question is, how to use the brightness channel to create a ROI, which I then use on the (not thresholded) hue channel. I am also open for completely different strategies, as long as they lead to the aim stated above. Is it maybe possible to set the brighness threshold directly in the RGB image and retrieve the hue histogramm without the need to create a ROI?

Looking forward to hearing your ideas.
Pepe
Reply | Threaded
Open this post in threaded view
|

Re: Analyzing hue after threshold on brightness

Romain Guiet
Hi pepe,
did you try to split HSB stack ? using Image->Stacks->Stack to images.
Then the Hue,Saturation and Brightness will be independent images, you can set your threshold, create/detect ROIs, restore them on your Hue image. see code below.
Romain


//-------------------start of code
title=getTitle();

// convert to HSB and split the stack
run("HSB Stack");
run("Stack to Images");

// get a ROI from the brightness
selectWindow("Brightness");
setAutoThreshold("Default dark");
setOption("BlackBackground", true);
run("Convert to Mask");

run("Create Selection");

// select the Hue, restore ROI and measure
selectWindow("Hue");
rename(title+"-Hue");
run("Restore Selection");
run("Measure");
//-------------------end of code
---------------------------------------------------------------
Dr. Romain Guiet
Bioimaging and Optics Platform (PT-BIOP)
Ecole Polytechnique Fédérale de Lausanne (EPFL)
Faculty of Life Sciences
Station 19, AI 0140
CH-1015 Lausanne

Phone: [+4121 69] 39629
http://biop.epfl.ch/
---------------------------------------------------------------

________________________________________
De : ImageJ Interest Group [[hidden email]] de la part de pepe86 [[hidden email]]
Envoyé : mercredi 22 avril 2015 23:55
À : [hidden email]
Objet : Analyzing hue after threshold on brightness

Dear community,
I have not much experience with ImageJ yet, but I am sure that some of you
can solve my problem within a few minutes.

I have an image of which I need to get the frequency of different hues, but
first I want to remove pixels with low brighness (background). So the aim is
to get a list of hue values of an image after applying a threshold on the
brightness of the pixels. Preferably using a Macro.

My idea was to split the imge in HSB, set the threshold on the brightness
channel, use the selection as a ROI, go back to the hue channel and export
the list of values from the histogram.

The problem I am facing is that the threshold that I set in the brightness
channel is also appearing in the hue channel, which means that also the hue
histogramm is thresholded, not only brightness.

So my question is, how to use the brightness channel to create a ROI, which
I then use on the (not thresholded) hue channel. I am also open for
completely different strategies, as long as they lead to the aim stated
above. Is it maybe possible to set the brighness threshold directly in the
RGB image and retrieve the hue histogramm without the need to create a ROI?

Looking forward to hearing your ideas.
Pepe



--
View this message in context: http://imagej.1557.x6.nabble.com/Analyzing-hue-after-threshold-on-brightness-tp5012575.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: Analyzing hue after threshold on brightness

pepe86
Hello Romain,
Thank you very much for the suggestion.
It worked great.
Best wishes,
Pepe