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

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

  • 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.


im – An image with inserted spheres indicated by True

Return type