def test_extract_class_bit(self): mask = np.arange(0, 9).reshape(3, 3) class_to_extract = [3] value_type = "bit" expected = np.array([[0, 0, 0], [0, 0, 0], [0, 0, 1]]) calculated = ImageTools.extract_class(mask, class_to_extract, value_type) np.testing.assert_array_almost_equal(expected, calculated)
def test_extract_class_threshold(self): mask = np.arange(0, 25).reshape(5, 5) class_to_extract = 10 value_type = "threshold" expected = np.array([[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) calculated = ImageTools.extract_class(mask, class_to_extract, value_type) np.testing.assert_array_almost_equal(expected, calculated)