pseudo_electrostatic_packing#

pseudo_electrostatic_packing(im, r, sites=None, clearance=0, protrusion=0, edges='extended', maxiter=1000)[source]#

Iterativley inserts spheres as close to the given sites as possible.

Parameters:
  • im (ndarray) – Image with True values indicating the phase where spheres should be inserted.

  • r (int) – Radius of spheres to insert.

  • sites (ndarray (optional)) – An image with True values indicating the electrostatic attraction points. If this is not given then the peaks in the distance transform are used.

  • clearance (int (optional, default=0)) – The amount of space to put between each sphere. Negative values are acceptable to create overlaps, but abs(clearance) < r.

  • protrusion (int (optional, default=0)) – The amount that spheres are allowed to protrude beyond the active phase.

  • maxiter (int (optional, default=1000)) – The maximum number of spheres to insert.

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

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

    ’contained’

    Spheres are all completely within the image

    ’extended’

    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.

Returns:

im – An image with inserted spheres indicated by True

Return type:

ndarray

Examples

Click here to view online example.