File tree 2 files changed +6
-15
lines changed
2 files changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -106,13 +106,13 @@ def smooth(self, kernel_size=5):
106
106
"""
107
107
Smooths the skeleton radius.
108
108
"""
109
+ kernel = torch .ones (1 , 1 , kernel_size )
109
110
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 )
116
116
117
117
118
118
@dataclass
Original file line number Diff line number Diff line change @@ -53,15 +53,6 @@ def select_path_points(
53
53
return idx_point [order ], idx_path [order ]
54
54
55
55
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
-
65
56
def sample_tree (
66
57
medial_pts ,
67
58
medial_radii ,
You can’t perform that action at this time.
0 commit comments