cbi_toolbox.simu.textures

The textures module allows to generate 3D textures for synthetic samples

cbi_toolbox.simu.textures.forward_simplex(coordinates, scale=1, out=None, seed=None)[source]

Computes simplex noise over given coordinates Noise values are in [-1, 1]

Parameters:
  • coordinates (np.ndarray [D, W, H, <Z>]) – coordinates where the noise must be computed (meshgrid)

  • scale (int, optional) – scale of the noise, by default 1

  • out (array, optional) – output array, by default None

  • seed (int, optional) – seed for the noise, by default None

Returns:

the simplex noise computed at the given coordinates

Return type:

np.ndarray [W, H, <Z>]

cbi_toolbox.simu.textures.simplex(shape, scale=1, seed=None)[source]

Generates 2D/3D simplex noise Noise values are in [-1, 1]

Parameters:
  • shape (tuple (int)) – shape of the texture array

  • scale (int, optional) – scale of the noise, by default 1

  • ndim (int, optional) – number of dimensions of the array to generate (2, 3), by default 3

  • seed (int, optional) – seed for the noise, by default None

Returns:

the simplex noise

Return type:

array [shape]

cbi_toolbox.simu.textures.spheres(shape, density=1, seed=None)[source]

Generates a texture full of hollow spheres

Parameters:
  • shape (tuple(int)) – shape of the texture array

  • density (int, optional) – spheres density in the texture, by default

  • seed (int, optional) – seed of the rng, default is None

Returns:

the texture

Return type:

array [shape]