Skip to content

Commit 344b288

Browse files
Fix unnecessary scalars on surface mesh (#240)
1 parent 397c682 commit 344b288

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/openlifu/seg/skinseg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ def create_closed_surface_from_labelmap(
274274
surface_mesh,
275275
)
276276

277+
# Some scalars can get tacked on by the above processing for some reason, so remove those in case they are present
278+
surface_mesh.GetPointData().SetScalars(None)
277279
return surface_mesh
278280

279281
def spherical_interpolator_from_mesh(

tests/test_skinseg.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ def test_create_closed_surface_from_labelmap():
107107
point_distance_from_sphere_center = np.linalg.norm(point_position - sphere_center, ord=2)
108108
assert np.abs(point_distance_from_sphere_center - sphere_radius) < 1.
109109

110+
# verify that there are no scalars on the point data since these are undesirable in slicer, and the function
111+
# isn't supposed to add a colormap or anything like that
112+
assert surface.GetPointData().GetScalars() is None
113+
110114
def test_spherical_interpolator_from_mesh():
111115
"""Check using a torus that the spherical interpolator behaves reasonably"""
112116
parametric_torus = vtk.vtkParametricTorus()

0 commit comments

Comments
 (0)