# HG changeset patch # User imgteam # Date 1710023243 0 # Node ID 8b74843c136e00d8c5b3c6d830a458fac5d28793 planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/voronoi_tesselation commit 43f036ed5341c36a1e076f9df9f47a3743ef4e6f diff -r 000000000000 -r 8b74843c136e test-data/input1.tiff Binary file test-data/input1.tiff has changed diff -r 000000000000 -r 8b74843c136e test-data/input1_result.tiff Binary file test-data/input1_result.tiff has changed diff -r 000000000000 -r 8b74843c136e voronoi_tessellation.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voronoi_tessellation.py Sat Mar 09 22:27:23 2024 +0000 @@ -0,0 +1,33 @@ +import argparse + +import numpy as np +import scipy.ndimage as ndi +import skimage.io +from skimage.segmentation import watershed + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser() + parser.add_argument('input') + parser.add_argument('output') + args = parser.parse_args() + + im = skimage.io.imread(args.input) + im = im.squeeze() + assert im.ndim == 2 + + distances = np.full(im.shape, np.inf) + for label in np.unique(im): + if label == 0: + continue + + label_distances = ndi.distance_transform_edt(im != label) + distances = np.min((distances, label_distances), axis=0) + + result = watershed( + image=distances, + markers=im, + ) + + skimage.io.imsave(args.output, result) diff -r 000000000000 -r 8b74843c136e voronoi_tessellation.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voronoi_tessellation.xml Sat Mar 09 22:27:23 2024 +0000 @@ -0,0 +1,53 @@ + + with scikit-image + + 0.22.0 + 0 + + + operation_3443 + + + scikit-image + scikit-image + + + numpy + scipy + scikit-image + + + + + + + + + + + + + + + + + + This tool computes Voronoi tessellations for labeled images. + Voronoi tessellations are also known as Vornoi diagrams, or Dirichlet tessellations. + Zero labels are treated as image background. + + + + 10.7717/peerj.453 + +