'Return the list of regions which are found by the following algorithm.
Raster Scanning Algorithm for Connected Component Analysis:
On the first pass:
1. Iterate through each element of the data by column, then by row (Raster Scanning)
2. If the element is not the background
1. Get the neighboring elements of the current element
2. If there are no neighbors, uniquely label the current element and continue
3. Otherwise, find the neighbor with the smallest label and assign it to the current element
4. Store the equivalence between neighboring labels
On the second pass:
1. Iterate through each element of the data by column, then by row
2. If the element is not the background
1. Relabel the element with the lowest equivalent label
( source: http://en.wikipedia.org/wiki/Connected_Component_Labeling )'

def __findRegions(self, im):

    (width, height) = im.size
    ImageOps.grayscale(im)
    im = im.convert('L')
    regions = {}
    pixel_region = [[0 for y in xrange(height)] for x in xrange(width)]
    equivalences = {}
    n_regions = 0
    for x in xrange(width):
        for y in xrange(height):
            if (im.getpixel((x, y)) == 0):
                region_n = (pixel_region[(x - 1)][y] if (x > 0) else 0)
                region_w = (pixel_region[x][(y - 1)] if (y > 0) else 0)
                max_region = max(region_n, region_w)
                if (max_region > 0):
                    new_region = min(filter((lambda i: (i > 0)), (region_n, region_w)))
                    if (max_region > new_region):
                        if (max_region in equivalences):
                            equivalences[max_region].add(new_region)
                        else:
                            equivalences[max_region] = set((new_region,))
                else:
                    n_regions += 1
                    new_region = n_regions
                pixel_region[x][y] = new_region
    for x in xrange(width):
        for y in xrange(height):
            r = pixel_region[x][y]
            if (r > 0):
                while (r in equivalences):
                    r = min(equivalences[r])
                if (r in regions):
                    regions[r].add(x, y)
                else:
                    regions[r] = self.__Region(x, y)
    return list(regions.itervalues())
