Skip to content
Snippets Groups Projects
Commit 655fbb62 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

RoiSet can now return and export two-channel images as both TIFs and PNGs

parent 16875cd2
No related branches found
No related tags found
No related merge requests found
......@@ -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'):
......
......@@ -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(
......
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