Login  Register

Re: How to find percentiles of intensity

Posted by Michael Schmid on Jan 20, 2015; 12:15pm
URL: http://imagej.273.s1.nabble.com/How-to-find-percentiles-of-intensity-tp5011293p5011300.html

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