<div dir="ltr">Hello David, <div><br></div><div>thanks for your answer. <br><br>I changed my `show` method like this: <br><br></div><div><div><font face="monospace, monospace"> def show(self):</font></div><div><font face="monospace, monospace"> # Render Window</font></div><div><font face="monospace, monospace"> rw = vtk.vtkRenderWindow()</font></div><div><font face="monospace, monospace"> rw.SetSize(800, 800)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> # Defining Bounds of Viewports</font></div><div><font face="monospace, monospace"> xmins = [0, 0.5]</font></div><div><font face="monospace, monospace"> xmaxs = [0.5, 1]</font></div><div><font face="monospace, monospace"> ymins = [0, 0]</font></div><div><font face="monospace, monospace"> ymaxs = [1, 1]</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> # Curvature Types</font></div><div><font face="monospace, monospace"> curv_types = ['Mean_Curvature', 'Gauss_Curvature']</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> for i in six.moves.range(2):</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> render = vtk.vtkRenderer()</font></div><div><font face="monospace, monospace"> rw.AddRenderer(render)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> # Mean Curvature View</font></div><div><font face="monospace, monospace"> render.SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i])</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> # Create mapper</font></div><div><font face="monospace, monospace"> mapper = vtk.vtkPolyDataMapper()</font></div><div><font face="monospace, monospace"> mapper.SetInputData(self.surface)</font></div><div><font face="monospace, monospace"> mapper.Update() # Probably useless</font></div><div><font face="monospace, monospace"> mapper.SetScalarRange(-1, 1)</font></div><div><font face="monospace, monospace"> mapper.SetArrayName(curv_types[0])</font></div><div><font face="monospace, monospace"> mapper.Update()</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> # ColorBar</font></div><div><font face="monospace, monospace"> color_bar = vtk.vtkScalarBarActor()</font></div><div><font face="monospace, monospace"> color_bar.SetLookupTable(mapper.GetLookupTable())</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> # Surface Actor</font></div><div><font face="monospace, monospace"> actor = vtk.vtkActor()</font></div><div><font face="monospace, monospace"> actor.SetMapper(mapper)</font></div><div><font face="monospace, monospace"> actor.GetProperty().EdgeVisibilityOn()</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> render.AddActor(actor)</font></div><div><font face="monospace, monospace"> render.AddActor2D(color_bar)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> import ipdb</font></div><div><font face="monospace, monospace"> ipdb.set_trace()</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> # Render Window Interactor</font></div><div><font face="monospace, monospace"> rwi = vtk.vtkRenderWindowInteractor()</font></div><div><font face="monospace, monospace"> rwi.SetRenderWindow(rw)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> rwi.Initialize()</font></div><div><font face="monospace, monospace"> rwi.Start()</font></div></div><div><br></div><div>but it's not working. </div><div><br></div><div>Actually stopping the execution at the first iteration of the `for` loop, and then triggering rwi.Initialize() and rwi.Start() just after the first iteration still shows that the Mapper is rendering the last scalar added to the `PolyData` and not the one specified by `mapper.SetArrayName`.</div><div><br></div><div>In my previous email, at least, if I stopped the execution at the first iteration and then manually triggering the rendering, was correctly showing the first scalar (i.e. `Mean_Curvatures`).</div><div><br></div><div>I'm still attaching the complete example.</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, May 31, 2018 at 10:07 PM David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Ruben,<div><br></div><div>Instead of data.SetActiveScalars(), use mapper.SetArrayId(i) or mapper.SetArrayName(name).</div><div><br></div><div> - David</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 31, 2018 at 8:57 AM, Ruben Di Battista <span dir="ltr"><<a href="mailto:rubendibattista@gmail.com" target="_blank">rubendibattista@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello, <div>I'm playing a bit with VTK and its Python bindings. I wrote down a simple case where I generate the distance function of a sphere, I extract the surface from it using the FlyingEdge3D algorithm, then I calculate the curvatures using the vtkCurvatures filter, and then I'd like to show the Mean_Curvature and the Gauss_Curvature in two different viewports. <br><br>What I tried to do is to use the `SetActiveScalars` method of the `PointData` associated to my `ImageData` dataset, but at the end I get two Viewports showing the same scalar (the last one activated). I also tried to stop the program execution using a debugger and triggering the render before the second scalar is made "active", and it correctly shows the first scalar field. So It's like that the two mappers rendered are "linked". <br><br>Do I need to do a ShallowCopy somewhere? <br></div></div></blockquote></div><br></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><font face="monospace, monospace"> _ </font></div><div><font face="monospace, monospace">-. .´ |∞∞∞∞</font></div><div><font face="monospace, monospace"> ', ; |∞∞∞∞∞∞</font></div><div><font face="monospace, monospace"> ˜˜ |∞∞∞∞∞∞∞∞∞ RdB </font></div><div><font face="monospace, monospace"> ,., |∞∞∞∞∞∞</font></div><div><font face="monospace, monospace"> .' '. |∞∞∞∞</font></div><div><font face="monospace, monospace">-' `'</font></div><div><font face="monospace, monospace"><a href="http://rdb.is" target="_blank">http://rdb.is</a></font></div><div><br></div></div></div>