Lets say I have the simple array:
data = [1,1,0,0,1,1,1]
I can apply labeling to this data with the scipy ndimage module with: