bm_dataset.convert_tiff2png module

Converting TIFF, SVS images to PNG

Convert the original TIFF image containing a pyramid to single image of a particular level (regarding the pyramid) using mosaic techniques

Be aware that this conversion takes lots of memory, for example image of size 50k x 60k takes about 10GB in RAM

Sample usage:

python convert_tiff2png.py -l 0 --nb_workers 2         -i "/datagrid/Medical/dataset_ANHIR/images_raw/*/*.tiff"
python convert_tiff2png.py -l 1 --nb_workers 5 --overwrite         -i "/datagrid/Medical/dataset_ANHIR/images_raw/*/*.svs"

Copyright (C) 2016-2019 Jiri Borovec <jiri.borovec@fel.cvut.cz>

bm_dataset.convert_tiff2png.arg_parse_params()[source]

parse the input parameters :return dict: parameters

bm_dataset.convert_tiff2png.convert_image(path_img, level=1, overwrite=False)[source]

convert TIFF/SVS image to standard format The output image has the same name and it is exported in the same folder

Parameters
  • path_img (str) – path to the input image

  • level (int) – selected level of the internal pyramid representation the level 0 means full scale and higher number is small image in pyramid scaling

  • overwrite (bool) – whether overwrite existing image on output

bm_dataset.convert_tiff2png.main(path_images, level=1, overwrite=False, nb_workers=1)[source]

main entry point

Parameters
  • path_images (str) – path to images

  • level (int) – selected level of the internal pyramid representation the level 0 means full scale and higher number is small image in pyramid scaling

  • overwrite (bool) – whether overwrite existing image on output

  • nb_workers (int) – nb jobs running in parallel