taufactor.utils

Functions

add_voxel_sphere(array, center_x, center_y, ...)

Create a voxelized representation of a sphere in 3D array based on given midpoint and radius in terms of pixel resolution.

compute_impedance(R, C, freq)

Compute impedance given resistor and capacitor arrays.

compute_impedance_batched(R, C, freq)

R, C: arrays of shape (bs, Nx) freq: array of shape (F,) or (bs, F) Returns: Z of shape (bs, F)

create_2d_diagonals(Nx[, features])

Create a 2D diagonal pattern extruded in z.

create_2d_zigzag(Nx[, features])

Create mirrored 2D diagonal channels (zigzag) extruded in z.

create_3d_diagonals(Nx[, features])

Create a 3D diagonal pattern.

create_fcc_cube(pixels[, overlap])

Create a voxelized FCC unit cell structure in a cube with given pixel resolution and overlap of the spheres.

create_stacked_blocks(Nx[, features])

Create stacked blocks with alternating half-block shifts in y and z.

extract_inner_features(labelled_array[, verbose])

flux_direction(im[, outpath])

Plots the flux direction of the image and provides code for transposing the image to change the flux direction :param im: segmented input image with n phases :return: None

relabel_random_order(array)

theoretical_fcc_metrics(a, overlap)

Return theoretical metrics of FCC unit cell structure.

taufactor.utils.add_voxel_sphere(array, center_x, center_y, center_z, radius)[source]

Create a voxelized representation of a sphere in 3D array based on given midpoint and radius in terms of pixel resolution.

taufactor.utils.compute_impedance(R, C, freq)[source]

Compute impedance given resistor and capacitor arrays. This is under the assumption of an excitation with amplitude 1 at the left boundary and zero flux at the right boundary (closed Warburg)

taufactor.utils.compute_impedance_batched(R, C, freq)[source]

R, C: arrays of shape (bs, Nx) freq: array of shape (F,) or (bs, F) Returns: Z of shape (bs, F)

taufactor.utils.create_2d_diagonals(Nx, features=1)[source]

Create a 2D diagonal pattern extruded in z.

taufactor.utils.create_2d_zigzag(Nx, features=1)[source]

Create mirrored 2D diagonal channels (zigzag) extruded in z.

taufactor.utils.create_3d_diagonals(Nx, features=1)[source]

Create a 3D diagonal pattern.

taufactor.utils.create_fcc_cube(pixels, overlap=0.0)[source]

Create a voxelized FCC unit cell structure in a cube with given pixel resolution and overlap of the spheres.

Parameters:
  • pixels (int) – Cube/Array side length given in pixels.

  • overlap (float) – Overlap of neighbouring spheres given in percent. 1 corresponds to radius = distance between midpoints.

Returns:

3D array where values of 1 represent the FCC structure.

Return type:

numpy.ndarray

taufactor.utils.create_stacked_blocks(Nx, features=1)[source]

Create stacked blocks with alternating half-block shifts in y and z.

The x-direction is divided into rows of block thickness feature_size. Every second x-row is shifted by half a block in y and z, producing a staggered (brick-like) arrangement in the yz-plane.

taufactor.utils.extract_inner_features(labelled_array, verbose=True)[source]
taufactor.utils.flux_direction(im, outpath=None)[source]

Plots the flux direction of the image and provides code for transposing the image to change the flux direction :param im: segmented input image with n phases :return: None

taufactor.utils.relabel_random_order(array)[source]
taufactor.utils.theoretical_fcc_metrics(a, overlap)[source]

Return theoretical metrics of FCC unit cell structure. Notation consistent with https://en.wikipedia.org/wiki/Spherical_cap