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

Home » Public Forums » archive » Re: How to create a 2D mask that automatically half’s an irregularly shaped 2D array from top to bottom?
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: How to create a 2D mask that automatically half’s an irregularly shaped 2D array from top to bottom? [message #78371 is a reply to message #78370] Fri, 18 November 2011 11:53 Go to previous messageGo to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On 11/18/11 10:04 AM, Dr G. wrote:
> Hi Folks,
>
> Q: Can the IDL geometry geniuses out there think of a fast way to
> create a 2D mask that automatically half�s an irregularly shaped 2D
> array along its x axis (i.e., from top to bottom) Eg:
>
> [0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0]
> [0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0]
> [0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0]
> [0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0]
> [0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0]
> [0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0]
> [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0]
> [0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0]
> [0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0]
> [0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0]
> [0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0]
> [0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0]
>
> Merci.
>
> Gf

If the input mask is "inmask":

; how many 1s are there?
rowtot = total(inmask, 1, /int)
; and it by checking if the cumulative total along the row is less
; than half of rowtot
outmask = inmask and (total(inmask, 1, /int, /cumul) le $
rebin(transpose(rowtot/2), masksize, /sample))

-Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: random forest implementation in IDL
Next Topic: Re: Plotting one ps file with different plots in separate pages

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

Current Time: Sat Oct 11 10:22:06 PDT 2025

Total time taken to generate the page: 1.76135 seconds