blobs#

blobs(shape: List[int], porosity: float = 0.5, blobiness: int = 1, divs: int = 1, seed=None)[source]#

Generates an image containing amorphous blobs

Parameters:
  • shape (list) – The size of the image to generate in [Nx, Ny, Nz] where N is the number of voxels

  • porosity (float) – If specified, this will threshold the image to the specified value prior to returning. If None is specified, then the scalar noise field is converted to a uniform distribution and returned without thresholding.

  • blobiness (int or list of ints(default = 1)) – Controls the morphology of the blobs. A higher number results in a larger number of small blobs. If a list is supplied then the blobs are anisotropic.

  • divs (int or array_like) – The number of times to divide the image for parallel processing. If 1 then parallel processing does not occur. 2 is equivalent to [2, 2, 2] for a 3D image. The number of cores used is specified in porespy.settings.ncores and defaults to all cores.

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

Returns:

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

Return type:

ndarray

See also

norm_to_uniform

Notes

This function generates random noise, the applies a gaussian blur to the noise with a sigma controlled by the blobiness argument as:

$$ np.mean(shape) / (40 * blobiness) $$

The value of 40 was chosen so that a blobiness of 1 gave a reasonable result.

Examples

Click here to view online example.