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

Home » Public Forums » archive » Search and Replace in 2D Array (Image)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Search and Replace in 2D Array (Image) [message #66656] Thu, 28 May 2009 12:24
vikramivatury is currently offline  vikramivatury
Messages: 24
Registered: May 2009
Junior Member
Hello,

I have an image "m" which is [1229 x 1229] pixels that contains 1's
and 0's. I also have an image "img" which is [1229 x 1229] that
contains pixel IDs. For every 1 in image "m" it corresponds to a
certain pixel ID in image "img". I am trying to write a loop in IDL
that scans through the pixels of image "m" and when its get to a 1,
spit out its information from "img". I used the 'where' function (w =
where m gt 1.........ids = img(w)) and that worked fine in outputting
a 1D array of 1510441 pixels, but I am trying to do it for a 2D array
using loops.

img = read_tiff('NP.tif')
ids = fltarr(1229,1229)

for i = 0,1228 do begin
for j = 0,1228 do begin
if (m(i,j) eq 1.) then begin
ids(i,j) = img(m(i,j))
endif
endfor
endfor

Any suggestions would be great.

Thanks,
Vikram
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: default device settings?
Next Topic: Re: Search and Replace in 2D Array (Image)

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

Current Time: Thu Oct 09 21:19:49 PDT 2025

Total time taken to generate the page: 0.07983 seconds