pseudo_gravity_packing(im, r, clearance=0, axis=0, maxiter=1000, edges='contained')[source]#

Iteratively inserts spheres at the lowest accessible point in an image, mimicking a gravity packing.

  • im (ndarray) – Image with True values indicating the phase where spheres should be inserted. A common option would be a cylindrical plug which would result in a tube filled with beads.

  • r (int) – The radius of the spheres to be added

  • clearance (int (default is 0)) – The amount space to add between neighboring spheres. The value can be negative for overlapping spheres, but abs(clearance) > r.

  • axis (int (default is 0)) – The axis along which gravity acts.

  • maxiter (int (default is 1000)) – The maximum number of spheres to add

  • edges (string (default is 'contained')) –

    Controls how the edges of the image are handled. Options are:


    Spheres are all completely within the image


    Spheres are allowed to extend beyond the edge of the image. In this mode the volume fraction will be less that requested since some spheres extend beyond the image, but their entire volume is counted as added for computational efficiency.


spheres – An image the same size as im with spheres indicated by True. The spheres are only inserted at locations that are accessible from the top of the image.

Return type:



Click here to view online example.