bm_dataset.crop_tissue_images module

Crop images around major object with set padding


Using these scripts for 1+GB images take several tens of GB RAM

Sample usage:

python         -i "/datagrid/Medical/dataset_ANHIR/images/COAD_*/scale-100pc/*.png"         --padding 0.1 --nb_workers 2

Copyright (C) 2016-2019 Jiri Borovec <>


parse the input parameters :return dict: {str: any}

bm_dataset.crop_tissue_images.crop_image(img_path, crop_dims=(0, 1), padding=0.15)[source]

crop umages to by tight around tissue

  • img_path (str) – path to image

  • crop_dims (tuple(int)) – crop in selected dimensions

  • padding (float) – padding around tissue

bm_dataset.crop_tissue_images.main(path_images, padding, nb_workers)[source]

main entry point

  • path_images (str) – path to the images

  • padding (float) – percentage of the image size to be used as padding around detected tissue in the scan image, the range is (0, 1)

  • nb_workers (int) – nb jobs running in parallel