17 Dec
2011
17 Dec
'11
11:13 a.m.
a = np.array([ � �[0,1,1,0,0,0], � �[0,1,1,0,1,0], � �[0,0,0,1,1,1], � �[0,0,0,0,1,0]])
This is the correct output, since the zero is not connected to any other region. In fact, ndimage labels it incorrectly as:
array([[0, 1, 1, 0, 0, 0], [0, 1, 1, 0, 1, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 0]])
Well, this is not incorrect, since ndimage.label only labels connected components of the foreground (True pixels). Emmanuelle