Skip to content

Commit def4a82

Browse files
authored
Merge pull request #73 from KVSlab/fixes-bifurcation
Refactor centerline tolerance
2 parents 255afec + c27c795 commit def4a82

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

morphman/common/centerline_operations.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,22 +239,21 @@ def get_curvilinear_coordinate(line):
239239
return curvilinear_coordinate
240240

241241

242-
def get_centerline_tolerance(centerline, n=50):
242+
def get_centerline_tolerance(centerline):
243243
"""
244244
Finds tolerance based on
245-
average length between first N points
245+
average length between points
246246
along the input centerline.
247247
248248
Args:
249249
centerline (vtkPolyData): Centerline data.
250-
n (int): Number of points
251250
252251
Returns:
253252
tolerance (float): Tolerance value.
254253
"""
255254
line = extract_single_line(centerline, 0)
256255
length = get_curvilinear_coordinate(line)
257-
tolerance = np.mean(length[1:n] - length[:n - 1]) / 2.0
256+
tolerance = np.mean(length[1:] - length[:-1]) / 2.0
258257

259258
return tolerance
260259

morphman/common/surface_operations.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ def compute_centers(polydata, case_path=None, select_inlet=False):
5656
inlet (list): A list of points.
5757
outlet (list): A flattened list with all the outlets.
5858
"""
59+
# Perform a 'light' smoothing to obtain a more uniform boundary
60+
polydata = vmtk_smooth_surface(polydata, method="laplace", iterations=100)
61+
5962
# Get cells which are open
6063
cells = vtk_extract_feature_edges(polydata)
6164

0 commit comments

Comments
 (0)