adding test for legacy peaks
@@ -177,17 +177,26 @@ class Snow2Test:
def test_trim_saddle_points(self):
np.random.seed(0)
- ps.settings.loglevel = 20
im = ps.generators.blobs(shape=[400, 400],
blobiness=[2, 1],
porosity=0.6)
dt = edt(im)
- # dt = ps.filters.trim_extrema(dt, h=.5)
peaks1 = ps.filters.find_peaks(dt=dt, r_max=4)
peaks2 = ps.filters.trim_saddle_points(peaks=peaks1, dt=dt)
assert (peaks1 > 0).sum() > (peaks2 > 0).sum()
assert (peaks2 > 0).sum() == 242
+ def test_trim_saddle_points_legacy(self):
+ np.random.seed(0)
+ im = ps.generators.blobs(shape=[400, 400],
+ blobiness=[2, 1],
+ porosity=0.6)
+ dt = edt(im)
+ peaks1 = ps.filters.find_peaks(dt=dt, r_max=4)
+ peaks2 = ps.filters.trim_saddle_points_legacy(peaks=peaks1, dt=dt)
+ assert (peaks1 > 0).sum() > (peaks2 > 0).sum()
+ assert (peaks2 > 0).sum() == 180
+
def test_accuracy_high(self):
im = ~ps.generators.lattice_spheres(shape=[100, 100, 100], r=15,
offset=22, spacing=28)
