comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL Average Value Graphs
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL Average Value Graphs [message #61456 is a reply to message #61413] Wed, 16 July 2008 11:18 Go to previous messageGo to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Jul 15, 4:51 pm, andyb...@gmail.com wrote:
> Hello, I was wondering if IDL has any built-in methods for two similar
> things.
> 1.  Basically cut the image like a pizza (for a variable number of
> slices) and average the values in each slice to create a plot of
> average pixel value as a function of angle
> 2.  Do the same thing, but plot the average pixel value as a function
> of radius, (concentric circles).
>
> I was going to write my own method, but it would be complicated
> converting angled lines or circles into pixels.
>
> Thanks a lot, Andy

I don't know of anything built-in, but I've written similar sorts of
things quite a lot using HISTOGRAM, and it's pretty straight-
forward... here's a (UNTESTED!) hack at it, assuming that your image
is called "image", is centered at pixel x0,y0, and you want n_azimuth
pie slices and radial bins of width dr:

indeximage=array_indices(image, lindgen(n_elements(image)))
pixelradii = sqrt( (indeximage[0,*]-x0)^2 + (indeximage[1,*]-y0)^2 )
pixelazimuth = atan(indeximage[1,*], indeximage[0,*])

radhist = histogram(pixelradii, min=0, bin=dr, reverse_indices=radri)
nrad=n_elements(radhist)
azhist = histogram(pixelazimuth, min=0, bin=2.*!pi/n_azimuth,
reverse_indices=azri)
naz=n_elements(azhist)

radial_mean = fltarr(nrad)
azimuthal_mean = fltarr(naz)
for i=0l,nrad-1 do if radhist[i] gt 0 then radial_mean[i] =
mean(image[radri[radri[i]:radri[i+1]-1]])
for i=0l,naz=1 do if azhist[i] gt 0 then azimuthal_mean[i] =
mean(image[azri[azri[i]:azri[i+1]-1]])

-Jeremy.



-Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Something Has Changed
Next Topic: QHULL/VORONOI question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 02:51:46 PDT 2025

Total time taken to generate the page: 0.79848 seconds