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

Home » Public Forums » archive » Re: Maximum Intensity without FOR Loop
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: Maximum Intensity without FOR Loop [message #39402] Tue, 11 May 2004 12:46 Go to previous message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
Stefan Tuchschmid wrote:
> Hi there
> a lot of posts talk about the necessity to avoid FOR loops ('if you
> use for loops, make sure a lot of stuff is happening in there...').
> However, I can't seem to find a better & working solution for the
> following code fragment:
>
> FOR i=0,x_resolution-1 DO BEGIN
> FOR j=0,y_resolution-1 DO BEGIN
> reformat_data[i,j,k]=MAX(data[i,j,lower_limit:upper_limit])
> ENDFOR
> ENDFOR
>
> Background: data is a image stack (MRI 3D Data), we would like to find
> the MIP (Maximum Intesity Projection) over a certain number of images.

Hi,

IDL> data = Bindgen(3,4,5)

You could use the DIMENSION keyword to MAX to find the maximum in that
dimension (across the entire array.)

IDL> print, max(data, dim = 3)
48 49 50
51 52 53
54 55 56
57 58 59


Or, you could find the maximum using the 'max' operator on specified
dismension (you can do more than two at a time.)

IDL> print, data[*,*,0] > data[*,*,2]
24 25 26
27 28 29
30 31 32
33 34 35

Ben
[Message index]
 
Read Message
Read Message
Previous Topic: Maximum Intensity without FOR Loop
Next Topic: RMS error

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

Current Time: Fri Oct 10 14:51:18 PDT 2025

Total time taken to generate the page: 0.95610 seconds