Skip to content

Commit f838491

Browse files
committed
cull_boundary_points
function to clean up user supplied key points that are too close to the volume boundary
1 parent 3cd2e4b commit f838491

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bigstream/features.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,13 @@ def match_points(A, B, scores, threshold):
9090
# return positions of corresponding points
9191
return a_pos[keeps, :3], b_pos[best_indcs[keeps], :3]
9292

93+
def cull_boundary_points(points, distance, volshape, offset=[0,0,0]):
94+
"""
95+
Only retain points farther than distance from the edges of volume with shape volshape
96+
"""
97+
upperlim = [i-distance for i in volshape]
98+
lowerlim = [distance for i in volshape]
99+
keep_lows = np.all(points[:,0:3] - offset > lowerlim, axis=1)
100+
keep_highs = np.all(points[:,0:3] - offset + 1 < upperlim, axis=1)
101+
idx = np.argwhere(keep_highs & keep_lows)
102+
return np.squeeze(points[idx,:])

0 commit comments

Comments
 (0)