tumourkit.segmentation.hovernet.extract_patches

Preprocess data into hovernet input format.

Copyright (C) 2023 Jose Pérez Cano

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Contact information: joseperez2000@hotmail.es

Functions

create_splits

img_list: List of image names to split.

generate_labels

Generates class GT.

main

main_with_args

save_batch

Loads data from paths and saves the joined array in npy format.

save_imgs

Saves RGB image, GT segmentation image and GT class image in png format.

save_npy

Saves data in the npy required format.

to4dim

Generates 3D numpy array where dimensions are: Height x Width x Channels Channels are: R, G, B, Ground Truth (segmentation) csv_dir is only needed for compatibility, it is not used.

to5dim

Generates 3D numpy array where dimensions are: Height x Width x Channels Channels are: R, G, B, GT (segmentation), GT (class)