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

Re: Watersheds and Label_Region for 1d



rshill@my-deja.com wrote:

>
>
> One cheap trick is to replicate the vector three times and do the
> label_region on the resulting 2-D array:
>
>     vec = [0,0,0,2,2,2,0,1,5,1,2,1,0,0,0,3,99,3,3]
>     arr = [0,vec,0] # [1,1,1]   ; Avoid edge effects.
>     lab2d = label_region(arr)
>     lab1d = (lab2d[*,1])[1:n_elements(vec)]
>
>

Smart and Cheap!  Thanks!

Ben


--
Ben Tupper

Bigelow Laboratory for Ocean Science
tupper@seadas.bigelow.org

pemaquidriver@tidewater.net