How to find percentiles of intensity

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

How to find percentiles of intensity

Avital Steinberg
Hi,
I would like to perform contrast stretching for an 8-bit image. When I use
set min and max, it gives me 0-255. (which does absolutely nothing in terms
of contrast stretching) When I check in ImageJ what values are used, it
looks like it takes 0 as min and 105 as max for a specific image that I
examined.

So my question is:

Is it possible to get less extreme values of the intensity values in order
to ignore the outliers, say the 5th and 95th percentiles of the intensity
values? If so - how?

Thank you,
Avital

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

Re: How to find percentiles of intensity

Michael Schmid
Hi Avital,

did you have a look at Process>Enhance contrast? There you can specify the percentage of saturated pixels. If you specify 1%, it will be 0.5% dark pixels becoming saturated black and 0.5% bright pixels becoming saturated white.

  http://rsb.info.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.5

For grayscale images, this only changes the lookup table. In the Brightness&Contrast panel, you can recover the original display with 'Reset' or make it a permanent change with 'Apply' (the latter only for 8-bit and color images).

Michael
________________________________________________________________
On Jan 20, 2015, at 07:41, Avital Steinberg wrote:

> Hi,
> I would like to perform contrast stretching for an 8-bit image. When I use
> set min and max, it gives me 0-255. (which does absolutely nothing in terms
> of contrast stretching) When I check in ImageJ what values are used, it
> looks like it takes 0 as min and 105 as max for a specific image that I
> examined.
>
> So my question is:
>
> Is it possible to get less extreme values of the intensity values in order
> to ignore the outliers, say the 5th and 95th percentiles of the intensity
> values? If so - how?
>
> Thank you,
> Avital

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

Re: How to find percentiles of intensity

Avital Steinberg
Thanks - I am writing a java plugin. How would I do what you describe in
Java?

Avital

On Tue, Jan 20, 2015 at 11:30 AM, Michael Schmid <[hidden email]>
wrote:

> Hi Avital,
>
> did you have a look at Process>Enhance contrast? There you can specify the
> percentage of saturated pixels. If you specify 1%, it will be 0.5% dark
> pixels becoming saturated black and 0.5% bright pixels becoming saturated
> white.
>
>   http://rsb.info.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.5
>
> For grayscale images, this only changes the lookup table. In the
> Brightness&Contrast panel, you can recover the original display with
> 'Reset' or make it a permanent change with 'Apply' (the latter only for
> 8-bit and color images).
>
> Michael
> ________________________________________________________________
> On Jan 20, 2015, at 07:41, Avital Steinberg wrote:
>
> > Hi,
> > I would like to perform contrast stretching for an 8-bit image. When I
> use
> > set min and max, it gives me 0-255. (which does absolutely nothing in
> terms
> > of contrast stretching) When I check in ImageJ what values are used, it
> > looks like it takes 0 as min and 105 as max for a specific image that I
> > examined.
> >
> > So my question is:
> >
> > Is it possible to get less extreme values of the intensity values in
> order
> > to ignore the outliers, say the 5th and 95th percentiles of the intensity
> > values? If so - how?
> >
> > Thank you,
> > Avital
>
> --
> 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: How to find percentiles of intensity

Michael Schmid
Hi Avital,

use Plugins>Macros>Record in 'Java' mode and try what it says when you do it manually.

You can also type 'L' (Plugins>Utilies>Find Command') to find out that "Enhance Contrast" uses the ij.plugin.ContrastEnhancer class, ant have a look at that class. You will see that it has two public methods that look promising:

  public void stretchHistogram(ImagePlus imp, double saturated)
  public void stretchHistogram(ImageProcessor ip, double saturated)

Michael
________________________________________________________________
On Jan 20, 2015, at 11:51, Avital Steinberg wrote:

> Thanks - I am writing a java plugin. How would I do what you describe in
> Java?
>
> Avital
>
> On Tue, Jan 20, 2015 at 11:30 AM, Michael Schmid <[hidden email]>
> wrote:
>
>> Hi Avital,
>>
>> did you have a look at Process>Enhance contrast? There you can specify the
>> percentage of saturated pixels. If you specify 1%, it will be 0.5% dark
>> pixels becoming saturated black and 0.5% bright pixels becoming saturated
>> white.
>>
>>  http://rsb.info.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.5
>>
>> For grayscale images, this only changes the lookup table. In the
>> Brightness&Contrast panel, you can recover the original display with
>> 'Reset' or make it a permanent change with 'Apply' (the latter only for
>> 8-bit and color images).
>>
>> Michael
>> ________________________________________________________________
>> On Jan 20, 2015, at 07:41, Avital Steinberg wrote:
>>
>>> Hi,
>>> I would like to perform contrast stretching for an 8-bit image. When I
>> use
>>> set min and max, it gives me 0-255. (which does absolutely nothing in
>> terms
>>> of contrast stretching) When I check in ImageJ what values are used, it
>>> looks like it takes 0 as min and 105 as max for a specific image that I
>>> examined.
>>>
>>> So my question is:
>>>
>>> Is it possible to get less extreme values of the intensity values in
>> order
>>> to ignore the outliers, say the 5th and 95th percentiles of the intensity
>>> values? If so - how?
>>>
>>> Thank you,
>>> Avital
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
> --
> 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: How to find percentiles of intensity

Avital Steinberg
Thanks, Michael - that was very helpful. I succeeded in using the commands
and the link helped me understand more about this subject,

Avital

On Tue, Jan 20, 2015 at 2:15 PM, Michael Schmid <[hidden email]>
wrote:

> Hi Avital,
>
> use Plugins>Macros>Record in 'Java' mode and try what it says when you do
> it manually.
>
> You can also type 'L' (Plugins>Utilies>Find Command') to find out that
> "Enhance Contrast" uses the ij.plugin.ContrastEnhancer class, ant have a
> look at that class. You will see that it has two public methods that look
> promising:
>
>   public void stretchHistogram(ImagePlus imp, double saturated)
>   public void stretchHistogram(ImageProcessor ip, double saturated)
>
> Michael
> ________________________________________________________________
> On Jan 20, 2015, at 11:51, Avital Steinberg wrote:
>
> > Thanks - I am writing a java plugin. How would I do what you describe in
> > Java?
> >
> > Avital
> >
> > On Tue, Jan 20, 2015 at 11:30 AM, Michael Schmid <
> [hidden email]>
> > wrote:
> >
> >> Hi Avital,
> >>
> >> did you have a look at Process>Enhance contrast? There you can specify
> the
> >> percentage of saturated pixels. If you specify 1%, it will be 0.5% dark
> >> pixels becoming saturated black and 0.5% bright pixels becoming
> saturated
> >> white.
> >>
> >>  http://rsb.info.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.5
> >>
> >> For grayscale images, this only changes the lookup table. In the
> >> Brightness&Contrast panel, you can recover the original display with
> >> 'Reset' or make it a permanent change with 'Apply' (the latter only for
> >> 8-bit and color images).
> >>
> >> Michael
> >> ________________________________________________________________
> >> On Jan 20, 2015, at 07:41, Avital Steinberg wrote:
> >>
> >>> Hi,
> >>> I would like to perform contrast stretching for an 8-bit image. When I
> >> use
> >>> set min and max, it gives me 0-255. (which does absolutely nothing in
> >> terms
> >>> of contrast stretching) When I check in ImageJ what values are used, it
> >>> looks like it takes 0 as min and 105 as max for a specific image that I
> >>> examined.
> >>>
> >>> So my question is:
> >>>
> >>> Is it possible to get less extreme values of the intensity values in
> >> order
> >>> to ignore the outliers, say the 5th and 95th percentiles of the
> intensity
> >>> values? If so - how?
> >>>
> >>> Thank you,
> >>> Avital
> >>
> >> --
> >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >>
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html