API reference

PixHomology is an open-source software for image processing and analysis focused on persistent homology computation. It provides a set of tools and algorithms to explore the topological features of 1D series and 2D images, enabling users to extract meaningful information about the underlying structures.

pixhomology.computePH(input_array: numpy.ndarray[numpy.float64], return_index: bool = False, maxdim: int = 0) object

A function that computes Persistent Homology (PH) on 1D series or 2D image data.

Parameters:
  • input_array (numpy.ndarray) -- A 1D/2D array representing the input image data on which Persistent Homology is to be computed.

  • return_index (bool, optional) -- A flag indicating whether to return indices of the features. Defaults to False.

  • maxdim (int, optional) -- The maximum dimension of homology to compute. Defaults to 0.

Returns:

  • dgms (numpy.ndarray or list of numpy.ndarray): If maxdim=0, an (N, 2) array with birth and death values of dimension zero. If maxdim=1, a list of arrays for dimension 0 and dimension 1.

  • indexes (numpy.ndarray or list of numpy.ndarray): If return_index=True. If maxdim=0, an (N, 4) array with x_birth, y_birth, x_death, y_death coordinates in pixels of dimension zero PH. If maxdim=1, a list of arrays for dimension 0 and dimension 1.

Return type:

numpy.ndarray or tuple

pixhomology.plotDGM(arg0: numpy.ndarray[numpy.float64]) object

A function that takes a 2D NumPy array (DGM) with dimensions (N, 2) as input and plots a persistence diagram. The first column of the input array corresponds to the x values (birth times), and the second column corresponds to the y values (death times).

Parameters:

input_array (numpy.ndarray) -- A 2D array representing the persistence diagram (DGM) to be plotted.

Returns:

The function plots the persistence diagram using matplotlib.

Return type:

None

pixhomology.plotIMG(arg0: numpy.ndarray[numpy.float64], arg1: numpy.ndarray[numpy.float64]) object

A function that takes 2D NumPy arrays, image and DGM indexes, as input and plots image with birth and death points for each component.

Parameters:
  • image (numpy.ndarray) -- A 2D array representing the image.

  • indexes (numpy.ndarray) -- A 2D array with dim (N, 4) representing the DGM indexes.

Returns:

The function plots the image with the persistence information.

Return type:

None