Re: 3-dimensional integration? [IDL 5.4] [message #35546 is a reply to message #35545] |
Mon, 23 June 2003 06:36  |
Timm Weitkamp
Messages: 66 Registered: August 2002
|
Member |
|
|
Hi Ingo,
Today at 12:37, you wrote:
> I am dealing with 3-dimensional experimental data of x-ray diffraction pole
> figures. I read-in the data, graphical representation (x,y,int) and analysis
> works fine with SURFACE... Now I would very much like to get the volume of
> certain regions of my figure, i.e. circles or squares around a certain point
> (x,y) in order to be able to compare the total intensities of peaks
> belonging together. Could anybody give me a hint with which approach I could
> solve that? Is MESH_VOLUME a senseful idea?
I don't know if this is what you're looking for, but to integrate your
data over a square of (2n+1)^2 pixels around the pixel with the indices
[x,y], just do
tot = TOTAL(data[x-n:x+n, y-n:y+n])
Circular regions take more than one line, but are easily doable too.
Assume that r is the radius of the circle over which you want to
integrate (in pixels). Then you should do something like this:
dim = SIZE(data, /DIMENSIONS) ; Find out size of data array
; Get x and y coordinate for each pixel
xarr = findgen(dim[0]) # (1+fltarr(dim[1]))
yarr = findgen(dim[1]) ## (1+fltarr(dim[0]))
; Get radial coordinate around (x,y) for each pixel
rarr = SQRT((xarr-x)^2 + (yarr-y)^2)
; Find out which pixels are inside a circle r around (x,y)
idxList = WHERE(rarr LE r, npix)
; Integrate over those pixels
IF npix NE 0 THEN tot = TOTAL(data[idxList])
Hope this helps,
Timm
--
Timm Weitkamp <http://people.web.psi.ch/weitkamp>
|
|
|