voronoi_edges(shape: List[int], ncells: int, r: int = 0, flat_faces: bool = True, seed=None, **kwargs)[source]#

Create an image from the edges of a Voronoi tessellation.

  • shape (array_like) – The size of the image to generate in [Nx, Ny, <Nz>] where Ni is the number of voxels in each direction. If Nz is not given a 2D image is returned.

  • ncells (int) – The number of Voronoi cells to include in the tesselation.

  • r (int, optional) – The radius to which Voronoi edges should be dilated in the final image. If not given then edges are a single pixel/voxel thick.

  • flat_faces (bool) – Whether the Voronoi edges should lie on the boundary of the image (True), or if edges outside the image should be removed (False).

  • seed (int, optional, default = None) – Initializes numpy’s random number generator to the specified state. If not provided, the current global value is used. This means calls to np.random.state(seed) prior to calling this function will be respected.


image – A boolean array with True values denoting the pore space

Return type:



Click here to view online example.