tumourkit.utils.preprocessing.read_labels

tumourkit.utils.preprocessing.read_labels(name: str, png_dir: str, csv_dir: str) Tuple[ndarray, DataFrame]

Reads a PNG and CSV file from the specified directories and returns their contents as a tuple.

Parameters:
  • name (str) – The base name of the files (without extensions).

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

  • csv_dir (str) – The directory containing the CSV file.

Returns:

A tuple containing the NumPy array of the PNG file and the Pandas DataFrame of the CSV file.

Return type:

Tuple[np.ndarray, pd.DataFrame] or None

This function reads a PNG and CSV file from the specified directories and returns their contents as a tuple. The function expects the PNG and CSV files to have specific filename formats: ‘<name>.GT_cells.png’ and ‘<name>.class.csv’. If the function is unable to read either file or encounters an error, it returns (None,`None`).