Skip to content
Snippets Groups Projects
Commit eb112783 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[data.image_utils] Remove unused code

parent 86fd2f9b
No related branches found
No related tags found
1 merge request!6Making use of LightningDataModule and simplification of data loading
Pipeline #76743 failed
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
"""Data loading code.""" """Data loading code."""
import pathlib
import numpy import numpy
import PIL.Image import PIL.Image
...@@ -47,70 +45,3 @@ def remove_black_borders( ...@@ -47,70 +45,3 @@ def remove_black_borders(
else: else:
raise NotImplementedError 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")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment