code: def from_labels(labels):
          
          labels = labels.astype(int)
  
          areas = scipy.ndimage.measurements.sum(labels != 0, labels, list(range(1, numpy.max(labels) + 1)))
  
          existing_labels = [i for (i, a) in enumerate(areas, 1) if a > 0]
  
          existing_areas = [a for a in areas if a > 0]
  
          existing_centers = scipy.ndimage.measurements.center_of_mass(labels != 0, labels, existing_labels)
  
          zipped = zip(existing_labels, existing_centers, existing_areas)
  
          features = [CellFeatures(c, a, i, labels.shape)
                      for i, c, a in zipped if a != 0]
  
          return features
docs: Creates list of cell features based on label image (1-oo pixel values)
  
          @return: list of cell features in the same order as labels