From f0b31aafe7f4f6fde8aa29c90449ca71bab285f3 Mon Sep 17 00:00:00 2001 From: Karol Gotkowski Date: Wed, 10 Jan 2024 10:57:55 +0100 Subject: [PATCH] fix: Fixed bugs originating from feature f3a3922 --- patchly/__init__.py | 2 +- patchly/aggregator.py | 2 +- patchly/tests/test_adaptive/test_adaptive_grid_sampler.py | 2 +- patchly/tests/test_crop/test_crop_grid_sampler.py | 2 +- patchly/tests/test_edge/test_edge_sampler.py | 2 +- patchly/tests/test_squeeze/test_squeeze_sampler.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/patchly/__init__.py b/patchly/__init__.py index b64a87a..0d38068 100644 --- a/patchly/__init__.py +++ b/patchly/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.0.14" +__version__ = "0.0.15" from patchly.sampler import GridSampler, SamplingMode from patchly.aggregator import Aggregator diff --git a/patchly/aggregator.py b/patchly/aggregator.py index 58bdb9c..bb68e50 100644 --- a/patchly/aggregator.py +++ b/patchly/aggregator.py @@ -398,7 +398,7 @@ def compute_patches(self) -> Tuple[_AdaptiveGridSampler, defaultdict, defaultdic :return: Tuple[_AdaptiveGridSampler, defaultdict, defaultdict] - Returns a tuple containing the chunk sampler, a dictionary mapping chunk IDs to patch data, and a dictionary mapping patch bounding boxes to chunk IDs. """ patch_sampler = self.sampler - chunk_sampler = _AdaptiveGridSampler(image_size_s=self.image_size_s, patch_size_s=self.chunk_size_s, step_size_s=self.chunk_size_s) + chunk_sampler = _AdaptiveGridSampler(image_h=None, image_size_s=self.image_size_s, patch_size_s=self.chunk_size_s, step_size_s=self.chunk_size_s) chunk_patch_dict = defaultdict(dict) patch_chunk_dict = defaultdict(dict) diff --git a/patchly/tests/test_adaptive/test_adaptive_grid_sampler.py b/patchly/tests/test_adaptive/test_adaptive_grid_sampler.py index d9909f9..d19846e 100644 --- a/patchly/tests/test_adaptive/test_adaptive_grid_sampler.py +++ b/patchly/tests/test_adaptive/test_adaptive_grid_sampler.py @@ -191,7 +191,7 @@ def _test_sampler(self, image, spatial_size, patch_size, step_size=None, spatial # Test without image result = np.zeros_like(image) - sampler = GridSampler(spatial_size=spatial_size, patch_size=patch_size, step_size=step_size, spatial_first=spatial_first, mode=SamplingMode.SAMPLE_ADAPTIVE) + sampler = GridSampler(image=None, spatial_size=spatial_size, patch_size=patch_size, step_size=step_size, spatial_first=spatial_first, mode=SamplingMode.SAMPLE_ADAPTIVE) for patch_bbox in sampler: result[slicer(result, patch_bbox)] = 1 diff --git a/patchly/tests/test_crop/test_crop_grid_sampler.py b/patchly/tests/test_crop/test_crop_grid_sampler.py index 325fb78..6755951 100644 --- a/patchly/tests/test_crop/test_crop_grid_sampler.py +++ b/patchly/tests/test_crop/test_crop_grid_sampler.py @@ -214,7 +214,7 @@ def _test_sampler(self, image, result_size, spatial_size, patch_size, step_size= # Test without image result = np.zeros(result_size) - sampler = GridSampler(spatial_size=spatial_size, patch_size=patch_size, step_size=step_size, spatial_first=spatial_first, mode=SamplingMode.SAMPLE_CROP) + sampler = GridSampler(image=None, spatial_size=spatial_size, patch_size=patch_size, step_size=step_size, spatial_first=spatial_first, mode=SamplingMode.SAMPLE_CROP) for patch_bbox in sampler: result[slicer(result, patch_bbox)] = 1 diff --git a/patchly/tests/test_edge/test_edge_sampler.py b/patchly/tests/test_edge/test_edge_sampler.py index b46a641..6d245cb 100644 --- a/patchly/tests/test_edge/test_edge_sampler.py +++ b/patchly/tests/test_edge/test_edge_sampler.py @@ -195,7 +195,7 @@ def _test_sampler(self, image, spatial_size, patch_size, step_size=None, spatial # Test without image result = np.zeros_like(image) - sampler = GridSampler(spatial_size=spatial_size, patch_size=patch_size, step_size=step_size, spatial_first=spatial_first, mode=SamplingMode.SAMPLE_EDGE) + sampler = GridSampler(image=None, spatial_size=spatial_size, patch_size=patch_size, step_size=step_size, spatial_first=spatial_first, mode=SamplingMode.SAMPLE_EDGE) for patch_bbox in sampler: result[slicer(result, patch_bbox)] = 1 diff --git a/patchly/tests/test_squeeze/test_squeeze_sampler.py b/patchly/tests/test_squeeze/test_squeeze_sampler.py index 76d20d9..2f49eb2 100644 --- a/patchly/tests/test_squeeze/test_squeeze_sampler.py +++ b/patchly/tests/test_squeeze/test_squeeze_sampler.py @@ -197,7 +197,7 @@ def _test_sampler(self, image, spatial_size, patch_size, step_size=None, spatial # Test without image result = np.zeros_like(image) - sampler = GridSampler(spatial_size=spatial_size, patch_size=patch_size, step_size=step_size, spatial_first=spatial_first, mode=SamplingMode.SAMPLE_SQUEEZE) + sampler = GridSampler(image=None, spatial_size=spatial_size, patch_size=patch_size, step_size=step_size, spatial_first=spatial_first, mode=SamplingMode.SAMPLE_SQUEEZE) for patch_bbox in sampler: result[slicer(result, patch_bbox)] = 1