Skip to content

Commit c8e147b

Browse files
committed
ENH: Add normals to each type
1 parent d77cea2 commit c8e147b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

surfer/viz.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,6 +2156,8 @@ def add_data(self, array, mlab_plot, vertices, smooth_mat, min, max,
21562156
self._geo.faces,
21572157
scalars=mlab_plot,
21582158
figure=self._f)
2159+
mesh.data.point_data.normals = self._geo.nn
2160+
mesh.data.cell_data.normals = None
21592161
if thresh is not None:
21602162
if array_plot.min() >= thresh:
21612163
warn("Data min is greater than threshold.")
@@ -2193,6 +2195,8 @@ def add_annotation(self, annot, ids, cmap):
21932195
self._geo.faces,
21942196
scalars=ids,
21952197
figure=self._f)
2198+
mesh.data.point_data.normals = self._geo.nn
2199+
mesh.data.cell_data.normals = None
21962200
surf = mlab.pipeline.surface(mesh, name=annot, figure=self._f)
21972201

21982202
# Set the color table
@@ -2210,6 +2214,8 @@ def add_label(self, label, label_name, color, alpha):
22102214
self._geo.faces,
22112215
scalars=label,
22122216
figure=self._f)
2217+
mesh.data.point_data.normals = self._geo.nn
2218+
mesh.data.cell_data.normals = None
22132219
surf = mlab.pipeline.surface(mesh, name=label_name, figure=self._f)
22142220
color = colorConverter.to_rgba(color, alpha)
22152221
cmap = np.array([(0, 0, 0, 0,), color]) * 255
@@ -2224,6 +2230,8 @@ def add_morphometry(self, morph_data, colormap, measure, min, max):
22242230
self._geo.faces,
22252231
scalars=morph_data,
22262232
figure=self._f)
2233+
mesh.data.point_data.normals = self._geo.nn
2234+
mesh.data.cell_data.normals = None
22272235

22282236
surf = mlab.pipeline.surface(mesh, colormap=colormap,
22292237
vmin=min, vmax=max,
@@ -2258,6 +2266,8 @@ def add_contour_overlay(self, scalar_data, min=None, max=None,
22582266
self._geo.faces,
22592267
scalars=scalar_data,
22602268
figure=self._f)
2269+
mesh.data.point_data.normals = self._geo.nn
2270+
mesh.data.cell_data.normals = None
22612271
thresh = mlab.pipeline.threshold(mesh, low=min)
22622272
surf = mlab.pipeline.contour_surface(thresh, contours=n_contours,
22632273
line_width=line_width)
@@ -2381,6 +2391,8 @@ def __init__(self, ol, figure):
23812391
kwargs = dict(scalars=ol.mlab_data, figure=figure)
23822392
if ol.pos_lims is not None:
23832393
pos_mesh = mlab.pipeline.triangular_mesh_source(*args, **kwargs)
2394+
pos_mesh.data.point_data.normals = self._geo.nn
2395+
pos_mesh.data.cell_data.normals = None
23842396
pos_thresh = mlab.pipeline.threshold(pos_mesh, low=ol.pos_lims[0])
23852397
self.pos = mlab.pipeline.surface(pos_thresh, colormap="YlOrRd",
23862398
vmin=ol.pos_lims[1],
@@ -2393,6 +2405,8 @@ def __init__(self, ol, figure):
23932405

23942406
if ol.neg_lims is not None:
23952407
neg_mesh = mlab.pipeline.triangular_mesh_source(*args, **kwargs)
2408+
neg_mesh.data.point_data.normals = self._geo.nn
2409+
neg_mesh.data.cell_data.normals = None
23962410
neg_thresh = mlab.pipeline.threshold(neg_mesh,
23972411
up=ol.neg_lims[0])
23982412
self.neg = mlab.pipeline.surface(neg_thresh, colormap="PuBu",

0 commit comments

Comments
 (0)