def test_3d_fallback_white_tophat(): image = np.zeros((7, 7, 7), dtype=bool) image[2, 2:4, 2:4] = 1 image[3, 2:5, 2:5] = 1 image[4, 3:5, 3:5] = 1 with expected_warnings([r'operator.*deprecated|\A\Z']): new_image = gray.white_tophat(image) footprint = ndi.generate_binary_structure(3, 1) with expected_warnings([r'operator.*deprecated|\A\Z']): image_expected = ndi.white_tophat(image.view(dtype=np.uint8), footprint=footprint) assert_array_equal(new_image, image_expected)
def test_white_tophat_black_pixel(self): for s in self.footprints: tophat = gray.white_tophat(self.black_pixel, s) assert np.all(tophat == 0)
def test_white_tophat_white_pixel(self): for s in self.selems: tophat = gray.white_tophat(self.white_pixel, s) assert np.all(tophat == self.white_pixel)