mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-31 12:41:20 +08:00
Fix selem test cases
This commit is contained in:
@@ -8,7 +8,7 @@ from numpy.testing import *
|
||||
from skimage import data_dir
|
||||
from skimage.io import *
|
||||
from skimage import data_dir
|
||||
from skimage.morphology import *
|
||||
from skimage.morphology import selem
|
||||
|
||||
|
||||
class TestSElem():
|
||||
@@ -36,7 +36,7 @@ class TestSElem():
|
||||
expected_mask = expected_mask[:, np.newaxis]
|
||||
assert_equal(expected_mask, actual_mask)
|
||||
k = k + 1
|
||||
|
||||
|
||||
def strel_worker_3d(self, fn, func):
|
||||
matlab_masks = np.load(os.path.join(data_dir, fn))
|
||||
k = 0
|
||||
@@ -48,20 +48,24 @@ class TestSElem():
|
||||
# Test center slice for each dimension. This gives a good
|
||||
# indication of validity without the need for a 3D reference
|
||||
# mask.
|
||||
c = int(expected_mask.shape[0]/2)
|
||||
c = int(expected_mask.shape[0]/2)
|
||||
assert_equal(expected_mask, actual_mask[c,:,:])
|
||||
assert_equal(expected_mask, actual_mask[:,c,:])
|
||||
assert_equal(expected_mask, actual_mask[:,:,c])
|
||||
k = k + 1
|
||||
|
||||
|
||||
def test_selem_disk(self):
|
||||
self.strel_worker("disk-matlab-output.npz", selem.disk)
|
||||
|
||||
def test_selem_diamond(self):
|
||||
self.strel_worker("diamond-matlab-output.npz", selem.diamond)
|
||||
|
||||
|
||||
def test_selem_ball(self):
|
||||
self.strel_worker_3d("disk-matlab-output.npz", selem.ball)
|
||||
|
||||
def test_selem_octahedron(self):
|
||||
self.strel_worker_3d("diamond-matlab-output.npz", selem.octahedron)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
np.testing.run_module_suite()
|
||||
|
||||
Reference in New Issue
Block a user