def test_3d_fallback_black_tophat(): image = np.ones((7, 7, 7), dtype=bool) image[2, 2:4, 2:4] = 0 image[3, 2:5, 2:5] = 0 image[4, 3:5, 3:5] = 0 new_image = grey.black_tophat(image) footprint = ndimage.generate_binary_structure(3,1) image_expected = ndimage.black_tophat(image,footprint=footprint) testing.assert_array_equal(new_image, image_expected)
def test_3d_fallback_black_tophat(): image = np.ones((7, 7, 7), dtype=bool) image[2, 2:4, 2:4] = 0 image[3, 2:5, 2:5] = 0 image[4, 3:5, 3:5] = 0 with expected_warnings(['operator.*deprecated|\A\Z']): new_image = grey.black_tophat(image) footprint = ndi.generate_binary_structure(3,1) with expected_warnings(['operator.*deprecated|\A\Z']): image_expected = ndi.black_tophat(image,footprint=footprint) testing.assert_array_equal(new_image, image_expected)
def test_3d_fallback_black_tophat(): image = np.ones((7, 7, 7), dtype=bool) image[2, 2:4, 2:4] = 0 image[3, 2:5, 2:5] = 0 image[4, 3:5, 3:5] = 0 with expected_warnings(['operator.*deprecated|\A\Z']): new_image = grey.black_tophat(image) footprint = ndi.generate_binary_structure(3, 1) with expected_warnings(['operator.*deprecated|\A\Z']): image_expected = ndi.black_tophat(image, footprint=footprint) assert_array_equal(new_image, image_expected)
def test_black_tophat_white_pixel(self): for s in self.selems: tophat = grey.black_tophat(self.white_pixel, s) assert np.all(tophat == 0)
def test_black_tophat_black_pixel(self): for s in self.selems: tophat = grey.black_tophat(self.black_pixel, s) assert np.all(tophat == (255 - self.black_pixel))