0)] print ncount if len(perc) > 0: labelList = arange(num + 1) area = measurements.sum(z, lw, index=labelList) areaImg = area[lw] maxArea = area.max() zz = (lw == perc[0]) # zz now contains the spanning cluster figure() imshow(zz, interpolation='nearest', origin='upper') # Display spanning cluster savefig("current.pdf") #show() #% Run walk on this cluster l,r = walk(zz) figure() imshow(l, interpolation='nearest', origin='upper') figure() imshow(r, interpolation='nearest', origin='upper') zzz = l*r # Find points where both l and r are non-zero figure() imshow(zzz, interpolation='nearest', origin='upper') colorbar() zadd = zz + zzz # #%subplot(2,2,1), imagesc(zz) #%subplot(2,2,2), figure() imshow(zadd, interpolation='nearest', origin='upper') colorbar() #%subplot(2,2,3), imagesc(zzz>0) #%subplot(2,2,4), imagesc(l+r>0) show()