diff --git a/src/ptbench/data/hivtb/__init__.py b/src/ptbench/data/hivtb/__init__.py index 88401da0f431df46325f0d122b1d4eac7a908d33..e004c1dcdaa983aea81d2c2afd67b7dbce25165d 100644 --- a/src/ptbench/data/hivtb/__init__.py +++ b/src/ptbench/data/hivtb/__init__.py @@ -20,7 +20,7 @@ import os from ...utils.rc import load_rc from .. import make_dataset from ..dataset import JSONDataset -from ..loader import load_pil_baw, make_delayed +from ..loader import load_pil_grayscale, make_delayed _protocols = [ importlib.resources.files(__name__).joinpath("fold_0.json.bz2"), @@ -40,7 +40,7 @@ _datadir = load_rc().get("datadir.hivtb", os.path.realpath(os.curdir)) def _raw_data_loader(sample): return dict( - data=load_pil_baw(os.path.join(_datadir, sample["data"])), + data=load_pil_grayscale(os.path.join(_datadir, sample["data"])), label=sample["label"], ) diff --git a/src/ptbench/data/image_utils.py b/src/ptbench/data/image_utils.py index b1c9d82e1ed43972817d9d6abeb6c8ffbde438ce..9103126f4179c552d7107471cc373a510500e2c0 100644 --- a/src/ptbench/data/image_utils.py +++ b/src/ptbench/data/image_utils.py @@ -96,8 +96,8 @@ def load_pil(path: str | pathlib.Path) -> PIL.Image.Image: return PIL.Image.open(path) -def load_pil_baw(path: str | pathlib.Path) -> PIL.Image.Image: - """Loads a sample data. +def load_pil_grayscale(path: str | pathlib.Path) -> PIL.Image.Image: + """Loads a sample data in grayscale mode ("L"). Parameters ---------- @@ -116,7 +116,7 @@ def load_pil_baw(path: str | pathlib.Path) -> PIL.Image.Image: def load_pil_rgb(path: str | pathlib.Path) -> PIL.Image.Image: - """Loads a sample data. + """Loads a sample data in RGB mode ("RGB"). Parameters ---------- diff --git a/src/ptbench/data/indian/__init__.py b/src/ptbench/data/indian/__init__.py index 5255c783daab1ca36b7f184d36339789a96ffd1d..889cf5132cd7711e90b6509f1d1cf0768b152117 100644 --- a/src/ptbench/data/indian/__init__.py +++ b/src/ptbench/data/indian/__init__.py @@ -19,7 +19,7 @@ import os from ...utils.rc import load_rc from .. import make_dataset from ..dataset import JSONDataset -from ..loader import load_pil_baw, make_delayed +from ..loader import load_pil_grayscale, make_delayed _protocols = [ importlib.resources.files(__name__).joinpath("default.json.bz2"), @@ -40,7 +40,7 @@ _datadir = load_rc().get("datadir.indian", os.path.realpath(os.curdir)) def _raw_data_loader(sample): return dict( - data=load_pil_baw(os.path.join(_datadir, sample["data"])), + data=load_pil_grayscale(os.path.join(_datadir, sample["data"])), label=sample["label"], ) diff --git a/src/ptbench/data/tbpoc/__init__.py b/src/ptbench/data/tbpoc/__init__.py index 6108b2fba5cad8611a8d6bd6c38467ee8a869807..4d9f455055203710549e879d5091078ade40f97e 100644 --- a/src/ptbench/data/tbpoc/__init__.py +++ b/src/ptbench/data/tbpoc/__init__.py @@ -20,7 +20,7 @@ import os from ...utils.rc import load_rc from .. import make_dataset from ..dataset import JSONDataset -from ..loader import load_pil_baw, make_delayed +from ..loader import load_pil_grayscale, make_delayed _protocols = [ importlib.resources.files(__name__).joinpath("fold_0.json.bz2"), @@ -40,7 +40,7 @@ _datadir = load_rc().get("datadir.tbpoc", os.path.realpath(os.curdir)) def _raw_data_loader(sample): return dict( - data=load_pil_baw(os.path.join(_datadir, sample["data"])), + data=load_pil_grayscale(os.path.join(_datadir, sample["data"])), label=sample["label"], ) diff --git a/src/ptbench/data/tbx11k_simplified/__init__.py b/src/ptbench/data/tbx11k_simplified/__init__.py index 7e66abc346f88faaeab7f0e61637b1767723aa3f..901975f6b30ab838641e7edbfaadb39e269b0835 100644 --- a/src/ptbench/data/tbx11k_simplified/__init__.py +++ b/src/ptbench/data/tbx11k_simplified/__init__.py @@ -28,7 +28,7 @@ import os from ...utils.rc import load_rc from ..dataset import JSONDataset -from ..loader import load_pil_baw, make_delayed, make_delayed_bbox +from ..loader import load_pil_grayscale, make_delayed, make_delayed_bbox _protocols = [ importlib.resources.files(__name__).joinpath("default.json.bz2"), @@ -51,14 +51,14 @@ _datadir = load_rc().get( def _raw_data_loader(sample): return dict( - data=load_pil_baw(os.path.join(_datadir, sample["data"])), # type: ignore + data=load_pil_grayscale(os.path.join(_datadir, sample["data"])), # type: ignore label=sample["label"], ) def _raw_data_loader_bbox(sample): return dict( - data=load_pil_baw(os.path.join(_datadir, sample["data"])), # type: ignore + data=load_pil_grayscale(os.path.join(_datadir, sample["data"])), # type: ignore label=sample["label"], bboxes=sample["bboxes"], ) diff --git a/src/ptbench/data/tbx11k_simplified_v2/__init__.py b/src/ptbench/data/tbx11k_simplified_v2/__init__.py index 57323beed9475e3f0c0992fd8ecb42b6fd3bb1cb..15e39e26d7196809b44d36bc9870808f8924127c 100644 --- a/src/ptbench/data/tbx11k_simplified_v2/__init__.py +++ b/src/ptbench/data/tbx11k_simplified_v2/__init__.py @@ -28,7 +28,7 @@ import os from ...utils.rc import load_rc from ..dataset import JSONDataset -from ..loader import load_pil_baw, make_delayed, make_delayed_bbox +from ..loader import load_pil_grayscale, make_delayed, make_delayed_bbox _protocols = [ importlib.resources.files(__name__).joinpath("default.json.bz2"), @@ -51,14 +51,14 @@ _datadir = load_rc().get( def _raw_data_loader(sample): return dict( - data=load_pil_baw(os.path.join(_datadir, sample["data"])), # type: ignore + data=load_pil_grayscale(os.path.join(_datadir, sample["data"])), # type: ignore label=sample["label"], ) def _raw_data_loader_bbox(sample): return dict( - data=load_pil_baw(os.path.join(_datadir, sample["data"])), # type: ignore + data=load_pil_grayscale(os.path.join(_datadir, sample["data"])), # type: ignore label=sample["label"], bboxes=sample["bboxes"], )