mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-19 11:27:45 +08:00
Test whether labels are left alone in label2rgb.
This commit is contained in:
@@ -3,7 +3,8 @@ import itertools
|
||||
import numpy as np
|
||||
from numpy import testing
|
||||
from skimage.color.colorlabel import label2rgb
|
||||
from numpy.testing import assert_array_almost_equal as assert_close
|
||||
from numpy.testing import (assert_array_almost_equal as assert_close,
|
||||
assert_array_equal)
|
||||
|
||||
|
||||
def test_shape_mismatch():
|
||||
@@ -80,6 +81,14 @@ def test_label_consistency():
|
||||
for label_id in label_2.flat:
|
||||
assert_close(rgb_1[label_1 == label_id], rgb_2[label_2 == label_id])
|
||||
|
||||
def test_leave_labels_alone():
|
||||
labels = np.array([-1, 0, 1])
|
||||
labels_saved = labels.copy()
|
||||
|
||||
label2rgb(labels)
|
||||
label2rgb(labels, bg_label=1)
|
||||
assert_array_equal(labels, labels_saved)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
testing.run_module_suite()
|
||||
|
||||
Reference in New Issue
Block a user