Optimization of blob algorithm utilizing the property that each cell with value must have a neighbour