[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New IDL User Questions




"John Piccirillo" <jpicciri@radiancetech.com> writes:
> 2.  Array Operations - Not being used to IDL type of array operations,
>         is there a simpler way to do the following?
>           a.
>              For I = 0, 199 Do Begin
>                  For J = 0, 84 Do Begin
>                       If (ImageMask[I,J] EQ 1) Then ImageROI[I,J,*] =
> ImageS[I,J,*]
>                       Else ImageROI[I,J,*] = 0
>                  EndFor
>             EndFor
>    I thought of using the WHERE function as in,
>         ROI = Where(ImageMask EQ 1)
>     but ImageROI[ROI} = ImageS{ROI} leaves out the third dimension.



JD may have been thinking of a different question here.  I believe you
want only a slight modification to your code:

         ROI = Where(ImageMask EQ 1)
         ImageROI[ROI,*] = ImageS[ROI,*]

This will include the third dimension.



>       b.     ;blow-up image X 9 For Screen Display
>  For j = 0,84 Do Begin
>        For i = 0,199 Do Begin
>   JImage[3*i,3*j]         = ImageS[i,j,[4]]
...
>       EndFor
>  EndFor



Liam plugged IMDISP so I will plug PLOTIMAGE on my web page.  If you
really just want to expand an image then it is very straightforward to
use the REBIN function.  Otherwise either Liam or my image display
program will be quite easy.


   JImage = rebin(ImageS[*,*,4], 200*3, 85*3, 1)

The extra "1" is because ImageS[*,*,4] is really a 200x85x1 array.


Craig

http://cow.physics.wisc.edu/~craigm/idl/idl.html  (PLOTIMAGE is under Graphics)

-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------