- blobs(shape: List[int], porosity: float = 0.5, blobiness: int = 1, divs: int = 1, seed=None)[source]#
Generates an image containing amorphous blobs
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
Noneis 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
1then parallel processing does not occur.
2is equivalent to
[2, 2, 2]for a 3D image. The number of cores used is specified in
porespy.settings.ncoresand 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.
image – A boolean array with
Truevalues denoting the pore space
- Return type:
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
blobinessof 1 gave a reasonable result.
Click here to view online example.