diff --git a/src/ptbench/data/image_utils.py b/src/ptbench/data/image_utils.py index 99df51c8ac6b6ac0425c0dbb6013ebf36bc3ab7c..3dce9cd27ac8cf5958a4c87d7233bf9efb265915 100644 --- a/src/ptbench/data/image_utils.py +++ b/src/ptbench/data/image_utils.py @@ -3,8 +3,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later """Data loading code.""" -import pathlib - import numpy import PIL.Image @@ -47,70 +45,3 @@ def remove_black_borders( else: raise NotImplementedError - - -class RemoveBlackBorders: - """Remove black borders of CXR.""" - - def __init__(self, threshold=0): - self.threshold = threshold - - def __call__(self, img): - return remove_black_borders(img, self.threshold) - - -def load_pil(path: str | pathlib.Path) -> PIL.Image.Image: - """Loads a sample data. - - Parameters - ---------- - - path - The full path leading to the image to be loaded - - - Returns - ------- - - image - A PIL image - """ - return PIL.Image.open(path) - - -def load_pil_grayscale(path: str | pathlib.Path) -> PIL.Image.Image: - """Loads a sample data in grayscale mode ("L"). - - Parameters - ---------- - - path - The full path leading to the image to be loaded - - - Returns - ------- - - image - A PIL image in grayscale mode - """ - return load_pil(path).convert("L") - - -def load_pil_rgb(path: str | pathlib.Path) -> PIL.Image.Image: - """Loads a sample data in RGB mode ("RGB"). - - Parameters - ---------- - - path - The full path leading to the image to be loaded - - - Returns - ------- - - image - A PIL image in RGB mode - """ - return load_pil(path).convert("RGB")