histocartography.preprocessing.utils module

Preprocessing utilities

Summary

Functions:

fast_histogram

Calculates a histogram of a matrix of the values from 0 up to (excluding) nr_values

load_image

Loads an image from a given path and returns it as a numpy array

save_image

Saves a provided image to a given path.

fast_histogram(input_array: numpy.ndarray, nr_values: int)numpy.ndarray[source]

Calculates a histogram of a matrix of the values from 0 up to (excluding) nr_values

Parameters
  • x (np.array) – Input tensor

  • nr_values (int) – Possible values. From 0 up to (exclusing) nr_values.

Returns

Output tensor

Return type

np.array

load_image(image_path: pathlib.Path)numpy.ndarray[source]

Loads an image from a given path and returns it as a numpy array

Parameters

image_path (Path) – Path of the image

Returns

Array representation of the image

Return type

np.ndarray

save_image(image_path: pathlib.Path, image: numpy.ndarray)None[source]

Saves a provided image to a given path.

Parameters
  • image_path (Path) – Path of the image

  • image (np.ndarray) – Image to save

Reference

If you use histocartography in your projects, please cite the following:

@inproceedings{pati2021,
    title = {Hierarchical Graph Representations for Digital Pathology},
    author = {Pushpak Pati, Guillaume Jaume, Antonio Foncubierta, Florinda Feroce, Anna Maria Anniciello, Giosuè Scognamiglio, Nadia Brancati, Maryse Fiche, Estelle Dubruc, Daniel Riccio, Maurizio Di Bonito, Giuseppe De Pietro, Gerardo Botti, Jean-Philippe Thiran, Maria Frucci, Orcun Goksel, Maria Gabrani},
    booktitle = {https://arxiv.org/pdf/2102.11057},
    year = {2021}
}