dataRange = shrink.GetOutput().GetCellData().GetArray('scalar').GetRange() print('DataRange (after shrink): ', dataRange) mapper.SetLookupTable(lut) mapper.SetColorModeToMapScalars() mapper.SetScalarModeToUseCellFieldData() mapper.SelectColorArray('scalar') mapper.SetScalarRange(dataRange[0], dataRange[1]) # Actors actor = svtk.svtkActor() actor.SetMapper(mapper) # Camera bd = htg.GetBounds() camera = svtk.svtkCamera() camera.SetClippingRange(1., 100.) focal = [] for i in range(3): focal.append(bd[ 2 * i ] + (bd[ 2 * i + 1 ] - bd[ 2 * i]) / 2.) camera.SetFocalPoint(focal) camera.SetPosition(focal[0], focal[1], focal[2] + 4.) # Renderer renderer = svtk.svtkRenderer() renderer.SetActiveCamera(camera) renderer.AddActor(actor) # Render window renWin = svtk.svtkRenderWindow() renWin.AddRenderer(renderer)
ren1 = svtk.svtkRenderer() renWin = svtk.svtkRenderWindow() renWin.AddRenderer(ren1) iren = svtk.svtkRenderWindowInteractor() iren.SetRenderWindow(renWin) # Add the actors to the renderer, set the background and size # ren1.AddActor(a) ren1.AddActor(clipActor) ren1.AddActor(contourActor) ren1.SetBackground(1, 1, 1) renWin.SetSize(250, 150) aCam = svtk.svtkCamera() aCam.SetFocalPoint(1.38705, 1.37031, 0.639901) aCam.SetPosition(1.89458, -5.07106, -4.17439) aCam.SetViewUp(0.00355726, 0.598843, -0.800858) aCam.SetClippingRange(4.82121, 12.1805) ren1.SetActiveCamera(aCam) renWin.Render() cam1 = ren1.GetActiveCamera() cam1.Zoom(1.5) # render the image # renWin.Render()