def test_mask2poly(): mask = np.zeros((10, 10), dtype=bool) mask[2:4, 3:7] = True multi_poly = ROI.mask2poly(mask) assert_equal( np.array(multi_poly[0].exterior.coords), np.array([[7., 3.5, 0.], [7., 2.5, 0.], [6.5, 2., 0.], [3.5, 2., 0.], [3., 2.5, 0.], [3., 3.5, 0.], [3.5, 4., 0.], [6.5, 4., 0.], [7., 3.5, 0.]]))