Skip to content

Commit

Permalink
Add unit tests for RAW tiled TIFF image
Browse files Browse the repository at this point in the history
  • Loading branch information
gigony committed Sep 28, 2021
1 parent 646c16b commit 537c76e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
36 changes: 33 additions & 3 deletions python/cucim/tests/fixtures/testimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,19 @@ def testimg_tiff_stripe_32x24_16_deflate(tmpdir_factory):
shutil.rmtree(dataset_path)


@pytest.fixture(scope='session')
def testimg_tiff_stripe_32x24_16_raw(tmpdir_factory):
dataset_path, image_path = gen_image(
tmpdir_factory, 'tiff::stripe:32x24:16:raw')
yield image_path
# Clean up fake dataset folder
shutil.rmtree(dataset_path)


@pytest.fixture(scope='session', params=[
lazy_fixture('testimg_tiff_stripe_32x24_16_jpeg'),
lazy_fixture('testimg_tiff_stripe_32x24_16_deflate')
lazy_fixture('testimg_tiff_stripe_32x24_16_deflate'),
lazy_fixture('testimg_tiff_stripe_32x24_16_raw')
])
def testimg_tiff_stripe_32x24_16(request):
return request.param
Expand All @@ -74,9 +84,19 @@ def testimg_tiff_stripe_4096x4096_256_deflate(tmpdir_factory):
shutil.rmtree(dataset_path)


@pytest.fixture(scope='session')
def testimg_tiff_stripe_4096x4096_256_raw(tmpdir_factory):
dataset_path, image_path = gen_image(
tmpdir_factory, 'tiff::stripe:4096x4096:256:raw')
yield image_path
# Clean up fake dataset folder
shutil.rmtree(dataset_path)


@pytest.fixture(scope='session', params=[
lazy_fixture('testimg_tiff_stripe_4096x4096_256_jpeg'),
lazy_fixture('testimg_tiff_stripe_4096x4096_256_deflate')
lazy_fixture('testimg_tiff_stripe_4096x4096_256_deflate'),
lazy_fixture('testimg_tiff_stripe_4096x4096_256_raw')
])
def testimg_tiff_stripe_4096x4096_256(request):
return request.param
Expand All @@ -101,9 +121,19 @@ def testimg_tiff_stripe_100000x100000_256_deflate(tmpdir_factory):
shutil.rmtree(dataset_path)


@pytest.fixture(scope='session')
def testimg_tiff_stripe_100000x100000_256_raw(tmpdir_factory):
dataset_path, image_path = gen_image(
tmpdir_factory, 'tiff::stripe:100000x100000:256:raw')
yield image_path
# Clean up fake dataset folder
shutil.rmtree(dataset_path)


@pytest.fixture(scope='session', params=[
lazy_fixture('testimg_tiff_stripe_100000x100000_256_jpeg'),
lazy_fixture('testimg_tiff_stripe_100000x100000_256_deflate')
lazy_fixture('testimg_tiff_stripe_100000x100000_256_deflate'),
lazy_fixture('testimg_tiff_stripe_100000x100000_256_raw')
])
def testimg_tiff_stripe_100000x100000_256(request):
return request.param
3 changes: 2 additions & 1 deletion python/cucim/tests/util/gen_tiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
from tifffile import TiffWriter

COMPRESSION_MAP = {'jpeg': ('jpeg', 95),
'deflate': 'deflate'}
'deflate': 'deflate',
'raw': None}


class TiffGenerator:
Expand Down

0 comments on commit 537c76e

Please sign in to comment.