Skip to content

Commit 8e1cb6b

Browse files
committed
deleted legacy path function
1 parent 490c6ce commit 8e1cb6b

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

Diff for: smart_tree/data_types/tree.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ def smooth(self, kernel_size=5):
106106
"""
107107
Smooths the skeleton radius.
108108
"""
109+
kernel = torch.ones(1, 1, kernel_size)
109110
for branch in self.branches.values():
110-
if branch.radii.shape[0] > kernel_size:
111-
branch.radii = F.conv1d(
112-
branch.radii.reshape(-1, 1, 1),
113-
torch.ones(1, 1, kernel_size),
114-
padding="same",
115-
).reshape(-1)
111+
branch.radii = F.conv1d(
112+
branch.radii.unsqueeze(2),
113+
kernel,
114+
padding=(kernel_size - 1) // 2,
115+
).squeeze(2)
116116

117117

118118
@dataclass

Diff for: smart_tree/skeleton/path.py

-9
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,6 @@ def select_path_points(
5353
return idx_point[order], idx_path[order]
5454

5555

56-
def find_branch_parent(idx_pt, idx_lookup):
57-
"""Finds which branch pt is from ...
58-
so we can work out the branch parent..."""
59-
for _id, _idxs in idx_lookup.items():
60-
if idx_pt in _idxs:
61-
return int(_id)
62-
return -1
63-
64-
6556
def sample_tree(
6657
medial_pts,
6758
medial_radii,

0 commit comments

Comments
 (0)