Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
In article <aghiu4$kcb$1@newsreader.wustl.edu>, Sean Raffuse <sean@me.wustl.edu> wrote: > Hello, > > I want to stretch an image based on it's frequency distribution: > stretched_image = bytscl(image, min=low, max=high) > where low is the bottom 5th percentile and high is the upper 5th percentile. > How can I get the values of the x percentile of a given array? > thanks in advance, > > Sean > I think the PERCENT option of HIST_EQUAL function will do what you want. It uses histogram and then TOTAL(histo,/CUMULATIVE) to find the cutoff points. Hope that helps, --Mike -- -- Michael Chinander University of Chicago m-chinander@uchicago.edu (773)834-5101 (Voice) (773)702-0371 (Fax)
Mike Chinander wrote: > > In article <aghiu4$kcb$1@newsreader.wustl.edu>, > Sean Raffuse <sean@me.wustl.edu> wrote: >> Hello, >> >> I want to stretch an image based on it's frequency distribution: >> stretched_image = bytscl(image, min=low, max=high) >> where low is the bottom 5th percentile and high is the upper 5th percentile. >> How can I get the values of the x percentile of a given array? >> thanks in advance, >> >> Sean >> > > I think the PERCENT option of HIST_EQUAL function will do what you want. > It uses histogram and then TOTAL(histo,/CUMULATIVE) to find the cutoff > points. Mike, That's a very useful suggestion, and I'll certainly use it myself. This keyword does not seem to be available for HIST_EQUAL in IDL 5.3. Do you know if it became available in IDL 5.4 or 5.5? I wrote a short example function for my book that accomplishes the same task. I've previously heard this technique referred to as "histogram clipping". The name of the function is imclip.pro, and it's available in the sample programs archive at http://www.gumley.com/PIP/About_Book.html Here's how it's used: a = dist(256) range = imclip(a, percent=5) tv, bytscl(a, min=range[0], max=range[1]) or with my IMDISP program imdisp, a, range=imclip(a, percent=5) Cheers, Liam. Practical IDL Programming http://www.gumley.com/
In article <3D2C5C38.5F3C7E6A@ssec.wisc.edu>, Liam E. Gumley <Liam.Gumley@ssec.wisc.edu> wrote: >> >> I think the PERCENT option of HIST_EQUAL function will do what you want. >> It uses histogram and then TOTAL(histo,/CUMULATIVE) to find the cutoff >> points. > > Mike, > > That's a very useful suggestion, and I'll certainly use it myself. This > keyword does not seem to be available for HIST_EQUAL in IDL 5.3. Do you > know if it became available in IDL 5.4 or 5.5? > I'm not sure. I'm running 5.5. The PERCENT keyword isn't mentioned in the 'What's New' files for either 5.4 or 5.5. It's described in the online help, so it must have been added in 5.4 if it's not in 5.3. --Mike -- -- Michael Chinander University of Chicago m-chinander@uchicago.edu (773)834-5101 (Voice) (773)702-0371 (Fax)