'Get sum of all pixels in each layer'

def _getsum(self):

    v = []
    for i in range(0, len(self.h), 256):
        layerSum = 0.0
        for j in range(256):
            layerSum += (j * self.h[(i + j)])
        v.append(layerSum)
    return v
