tumourkit.utils.preprocessing.read_png

tumourkit.utils.preprocessing.read_png(name: str, png_dir: str) ndarray

Reads a PNG file from the specified directory and returns its image data as a NumPy array.

Parameters:
  • name (str) – The name of the PNG file (without extension).

  • png_dir (str) – The directory containing the PNG file.

Returns:

A NumPy array containing the image data.

Return type:

np.ndarray or None

This function reads a PNG file from the specified directory and returns its image data as a NumPy array. The function expects the PNG file to have a specific filename format: ‘<name>.GT_cells.png’. If the function is unable to read the PNG file or encounters an error, it returns None.