def __init__(self, array, grid, min_distance, threshold_abs): from skimage.morphology import watershed super().__init__(array, grid) watershed_array = np.flipud(self.array) tops = self.local_maxima(min_distance=min_distance, threshold_abs=threshold_abs).array labels = watershed(-watershed_array, tops, mask=watershed_array) self.segments = gisexport.array_to_polygons(labels, affine=None)
def segments(self): return gisexport.array_to_polygons(self.labels, affine=self._affine)