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
On Sat, Dec 17, 2011 at 3:13 AM, Emmanuelle Gouillart <emmanuelle.gouillart@nsup.org> wrote:
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).
Right, so zero is a magical value. I guess it's pretty easy to get the same out of our implementation by simply masking out all uninteresting values, and calling "unique" to get the remaining labels?
participants (2)
-
Emmanuelle Gouillart
-
Stéfan van der Walt