mednet.data.image_utils

Data loading code.

Functions

remove_black_borders(img[, threshold])

Remove black borders of CXR.

mednet.data.image_utils.remove_black_borders(img, threshold=0)[source]

Remove black borders of CXR.

Parameters:
  • img (Image) – A PIL image.

  • threshold (int) – Threshold value from which borders are considered black. Defaults to 0.

Return type:

tuple[Image, ndarray[tuple[int, ...], dtype[bool]]]

Returns:

A PIL image with black borders removed, and the mask used to remove the black borders from the image, that can be subsequently used to process other related image information (e.g. annotation masks).