diff --git a/model_server/base/roiset.py b/model_server/base/roiset.py index df00d2b15bd92c13f2f051b16d747a795d1fa265..11deff15fbe3b164c65d16931f063b437b2f7f99 100644 --- a/model_server/base/roiset.py +++ b/model_server/base/roiset.py @@ -427,7 +427,7 @@ class RoiSet(object): def _export_patch(roi): patch = InMemoryDataAccessor(roi.patch) - ext = 'tif' if make_3d or patch.chroma > 3 else 'png' + ext = 'tif' if make_3d or patch.chroma > 3 or kwargs.get('force_tif') else 'png' fname = f'{prefix}-la{roi.label:04d}-zi{roi.zi:04d}.{ext}' if patch.dtype is np.dtype('uint16'): diff --git a/tests/test_roiset.py b/tests/test_roiset.py index 326d874d150506cbada0052b95952cafa3850ce1..240787205a1f3ae16ec14d086a0847d1ebb1d247 100644 --- a/tests/test_roiset.py +++ b/tests/test_roiset.py @@ -304,7 +304,7 @@ class TestRoiSetMultichannelProducts(BaseTestRoiSetMonoProducts, unittest.TestCa self.assertEqual(result.chroma, 1) def test_multichannel_to_color_2d_patches(self): - chs = [0, 2, 4, 1] + chs = [0, 2,] where = output_path / 'multichannel' / 'color_2d_patches' self.assertGreater(self.roiset.acc_raw.chroma, 1) patches_acc = self.roiset.get_patches_acc(channels=chs) @@ -316,11 +316,11 @@ class TestRoiSetMultichannelProducts(BaseTestRoiSetMonoProducts, unittest.TestCa draw_bounding_box=True, expanded=True, pad_to=256, + force_tif=True, ) result = generate_file_accessor(where / df_res.patch_path.iloc[0]) self.assertEqual(result.chroma, len(chs)) - def test_multichannnel_to_mono_2d_patches_rgb_bbox(self): where = output_path / 'multichannel' / 'mono_2d_patches_rgb_bbox' df_res = self.roiset.export_patches(