|
24 | 24 | merge_vertical_chunkwise, |
25 | 25 | ) |
26 | 26 | from tiatoolbox.utils import env_detection as toolbox_env |
27 | | -from tiatoolbox.utils.misc import imread |
| 27 | +from tiatoolbox.utils.misc import download_data, imread |
28 | 28 | from tiatoolbox.wsicore import WSIReader |
29 | 29 |
|
30 | 30 | if TYPE_CHECKING: |
@@ -150,6 +150,38 @@ def _test_store_output_patch(output: Path) -> None: |
150 | 150 | assert annotations_properties is not None |
151 | 151 |
|
152 | 152 |
|
| 153 | +def test_semantic_segmentor_tiles(track_tmp_path: Path) -> None: |
| 154 | + """Tests SemanticSegmentor on image tiles with no mpp metadata.""" |
| 155 | + segmentor = SemanticSegmentor( |
| 156 | + model="fcn-tissue_mask", batch_size=32, verbose=False, device=device |
| 157 | + ) |
| 158 | + |
| 159 | + sample_image = track_tmp_path / "breast_tissue.jpg" |
| 160 | + |
| 161 | + download_data( |
| 162 | + "https://tiatoolbox.dcs.warwick.ac.uk/sample_imgs/breast_tissue.jpg", |
| 163 | + sample_image, |
| 164 | + ) |
| 165 | + |
| 166 | + inputs = [sample_image] |
| 167 | + |
| 168 | + output = segmentor.run( |
| 169 | + images=inputs, |
| 170 | + device=device, |
| 171 | + patch_mode=False, |
| 172 | + auto_get_mask=False, |
| 173 | + save_dir=track_tmp_path / "output", |
| 174 | + input_resolutions=[{"units": "baseline", "resolution": 1.0}], |
| 175 | + patch_input_shape=(1024, 1024), |
| 176 | + ) |
| 177 | + |
| 178 | + output = zarr.open(output[sample_image], mode="r") |
| 179 | + |
| 180 | + assert output["predictions"].shape == (2048, 3584) |
| 181 | + |
| 182 | + sample_image.unlink() |
| 183 | + |
| 184 | + |
153 | 185 | def test_save_annotation_store(remote_sample: Callable, track_tmp_path: Path) -> None: |
154 | 186 | """Test for saving output as annotation store.""" |
155 | 187 | segmentor = SemanticSegmentor( |
|
0 commit comments