Skip to content

Commit 4115597

Browse files
docs: describe why we run the filter twice
1 parent ffdc090 commit 4115597

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kimimaro/utility.py

+4
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ def cross_sectional_area(
154154

155155
normals = (path[1:] - path[:-1]).astype(np.float32)
156156
normals = np.concatenate([ normals, [normals[-1]] ])
157+
158+
# Running the filter in the forward and then backwards
159+
# direction eliminates phase shift.
157160
normals = moving_average(normals, smoothing_window)
161+
normals = moving_average(normals[::-1], smoothing_window)[::-1]
158162

159163
for i in range(len(normals)):
160164
normal = normals[i,:]

0 commit comments

Comments
 (0)