Skip to content

Commit 5ed3231

Browse files
committed
Address vtk deprecation warning in vtkCellArray (#367)
1 parent ba1d5be commit 5ed3231

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/openlifu/seg/skinseg.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,10 @@ def _spherical_interpolator_from_mesh_embree(surface_mesh : vtk.vtkPolyData) ->
443443
vtk_points = surface_mesh.GetPoints()
444444
points_np = vtk_to_numpy(vtk_points.GetData()).astype(np.float64) # (N,3)
445445
polys = surface_mesh.GetPolys()
446-
polys_np = vtk_to_numpy(polys.GetData()) # flat array [3,i0,i1,i2,3,i0,i1,i2,...]
447-
if polys_np.size == 0:
446+
connectivity_np = vtk_to_numpy(polys.GetConnectivityArray())
447+
if connectivity_np.size == 0:
448448
raise RuntimeError("Input mesh has no polygons after transformation/triangulation.")
449-
polys_np = polys_np.reshape(-1, 4) # (M, 4)
450-
faces_np = polys_np[:, 1:4].astype(np.int64) # (M, 3)
449+
faces_np = connectivity_np.reshape(-1, 3).astype(np.int64) # (M, 3)
451450

452451
r_squared = np.sum(points_np**2, axis=1)
453452

src/openlifu/virtual_fit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def __post_init__(self):
141141
if not isinstance(self.top_n_candidates, int ):
142142
raise TypeError("Number of transducer transform candidates returned must be an integer")
143143
if self.top_n_candidates <= 0:
144-
raise TypeError("Number of transducer transform candidates returned must be greater than 0")
144+
raise ValueError("Number of transducer transform candidates returned must be greater than 0")
145145

146146
def to_units(self, target_units: str) -> VirtualFitOptions:
147147
"""Do unit conversion and return a version of this VirtualFitOptions that uses

0 commit comments

Comments
 (0)