[R-sig-Geo] enumerate grid clusters/patches with size of contiguous cluster

Murray Richardson murray.richardson at utoronto.ca
Wed Mar 12 17:59:28 CET 2008


Hello friends,

I am trying to take a binary input grid of patches (connected cells with 
value = 1), and assign to each non-zero cell the total number of pixels 
comprising the patch to which it belongs. 

So for a connected patch of 27 pixels, all cells belonging to that patch 
will have a value of 27.

Just wondering if anyone has any suggestions.  Maybe a function I don't 
know about yet...

Thanks in advance,

Murray Richardson




More information about the R-sig-Geo mailing list