mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-02 16:31:29 +08:00
Add tests for multipage_rgb tif
This commit is contained in:
@@ -69,12 +69,18 @@ def test_imread_separate_channels():
|
||||
f = NamedTemporaryFile(suffix='.tif')
|
||||
fname = f.name
|
||||
f.close()
|
||||
imsave(fname, x, plugin='tifffile')
|
||||
img = imread(fname, plugin='tifffile')
|
||||
imsave(fname, x)
|
||||
img = imread(fname)
|
||||
os.remove(fname)
|
||||
assert img.shape == (16, 8, 3), img.shape
|
||||
|
||||
|
||||
@skipif(not imread_available)
|
||||
def test_imread_multipage_rgb_tif():
|
||||
img = imread(os.path.join(data_dir, 'multipage_rgb.png'))
|
||||
assert img.shape == (10, 10, 3), img.shape
|
||||
|
||||
|
||||
class TestSave:
|
||||
def roundtrip(self, x, scaling=1):
|
||||
f = NamedTemporaryFile(suffix='.png')
|
||||
|
||||
@@ -4,6 +4,7 @@ import numpy as np
|
||||
from numpy.testing import assert_raises, assert_equal, assert_allclose
|
||||
|
||||
from skimage import data_dir
|
||||
from skimage.io import use_plugin
|
||||
from skimage.io.collection import MultiImage, ImageCollection
|
||||
|
||||
import six
|
||||
@@ -14,7 +15,8 @@ class TestMultiImage():
|
||||
def setUp(self):
|
||||
# This multipage TIF file was created with imagemagick:
|
||||
# convert im1.tif im2.tif -adjoin multipage.tif
|
||||
paths = [os.path.join(data_dir, 'multipage.tif'),
|
||||
use_plugin('pil')
|
||||
paths = [os.path.join(data_dir, 'multipage_rgb.tif'),
|
||||
os.path.join(data_dir, 'no_time_for_that.gif')]
|
||||
self.imgs = [MultiImage(paths[0]),
|
||||
MultiImage(paths[0], conserve_memory=False),
|
||||
@@ -24,6 +26,12 @@ class TestMultiImage():
|
||||
ImageCollection(paths[1], conserve_memory=False),
|
||||
ImageCollection('%s:%s' % (paths[0], paths[1]))]
|
||||
|
||||
def test_shapes(self):
|
||||
img = self.imgs[-1]
|
||||
imgs = img[:]
|
||||
assert imgs[0].shape == imgs[1].shape
|
||||
assert imgs[0].shape == (10, 10, 3)
|
||||
|
||||
def test_len(self):
|
||||
assert len(self.imgs[0]) == len(self.imgs[1]) == 2
|
||||
assert len(self.imgs[2]) == len(self.imgs[3]) == 24
|
||||
|
||||
Reference in New Issue
Block a user