Docs: utils module

Contents:

euchar.utils.center_tetrahedron(A, B, C, D)
euchar.utils.center_triangle(A, B, C)
euchar.utils.circumcenter_is_inside(circum, A, B, C, D)
euchar.utils.circumcenter_tetra(A, B, C, D)

Compute circumcenter of 4 points in 3 dimensions.

A, B, C, D

np.arrays, the four vertices of the tetrahedron

circumcenter

np.array, the circumcenter of the four points

euchar.utils.circumcenter_triangle(A, B, C)

Compute circumcenter of 3 points in 2 or 3 dimensions.

A, B, C

np.arrays of length equal to the Euclidean dimension.

circumcenter

np.array, the circumcenter of the three points

euchar.utils.circumradius_tetra(A, B, C, D)

Compute circumradius of 4 points in 3 dimensions.

A, B, C, D

np.arrays, the four vertices of the tetrahedron

circumradius

np.array, the circumradius of the four points

euchar.utils.circumradius_triangle(A, B, C)

Compute circumradius of 3 points in 2 or 3 dimensions.

A, B, C

np.arrays of length equal to the Euclidean dimension.

circumradius

float, circumradius of the 3 points.

euchar.utils.estimate_inverse_density(points, n)

Estimates the inverse of the density at each p in points as the root mean square of the distances from p to its n nearest neighbors.

points

np.ndarray of shape (N, d)

n

int, number of nearest neighbors used to estimate the inverse of the density.

param_vertices

1-D np.ndarray parametrizing vertices by inverse density.

euchar.utils.is_acute(lengths)

Check if a triangle is acute with Pythgoras theorem.

euchar.utils.is_on_correct_side(A, B, C, test_point, point)
euchar.utils.magnitude(v)

Euclidean norm of the vector v.

euchar.utils.parameter_tetrahedron(A, B, C, D)

Compute the Alpha filtration parameter of a tetrahedron of vertices A, B, C, D.

A, B, C, D

np.arrays, the four vertices of the tetrahedron.

parameter

float, Alpha filtration parameter of the tetrahedron.

euchar.utils.parameter_triangle(A, B, C)

Compute the Alpha filtration parameter of a triangle of vertices A, B, C.

A, B, C

np.arrays, the three vertices of the triangle

parameter

float, Alpha filtration parameter of the triangle. This is twice the circumradius of the triangle if the triangle is acute, or it is the greatest value among the length of edges of the triangle.

euchar.utils.simplices_to_dimensions(simplices)

Transforms an array of simplices to an array of their dimensions.

Given the array of simplices

>>> [[1 -1 -1], [3 4 -1], [10 12 15]]

the output will be

>>> [0 1 2]
euchar.utils.vector_all_euler_changes_in_2D_images()

Returns a vector of 256 integers, containing all the possible Euler characteristic changes produced by the insertion of a central pixel in a 3x3 binary neighbourhood.

euchar.utils.vector_all_euler_changes_in_3D_images(start=0, end=67108864)

Returns a vector of 67,108,864 integers, containing all the possible Euler characteristic changes produced by the insertion of a central voxel in a 3x3x3 binary neighbourhood.

It is recommended to produce this vector once and to write it to a file. For example with numpy

>>> vector_changes = vector_all_euler_changes_in_3d_images()
>>> np.save("/path/to/dir/changes_3d.npy", vector_changes)

The next time the vector can be loaded with

>>> vector_changes = np.load("/path/to/dir/changes_3d.npy")
euchar.utils.vol_tetra(A, B, C, D)

Volume of the tetrahedron whose four vertices are the given four points A, B, C, D.

A, B, C, D

np.arrays, the four vertices of the tetrahedron

volume

float, the volume of the tetrahedron