<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 <img src="imgs/header.png">
Visualization techniques for scalar fields in VTK + Python
Reminder
Step1:  1. Data input (source)
Step2:  2. Filters
Filter 1
Step3:  3. Mappers
Mapper
Step4:  4. Actors
Step5:  5. Renderers and Windows
<ASSISTANT_TASK:>
Python Code:
%gui qt
import vtk
from vtkviewer import SimpleVtkViewer
#help(vtk.vtkRectilinearGridReader())
Explanation: <img src="imgs/header.png">
Visualization techniques for scalar fields in VTK + Python
Reminder: The VTK pipeline
<img src="imgs/vtk_pipeline.png", align=left>
$~$
Visualizing data within a recilinear grid
The following code snippets show step by step the how to create a pipeline to visualize the outline of a rectilinear grid.
End of explanation
# do not forget to call "Update()" at the end of the reader
rectGridReader = vtk.vtkRectilinearGridReader()
rectGridReader.SetFileName("data/jet4_0.500.vtk")
rectGridReader.Update()
Explanation: 1. Data input (source)
End of explanation
rectGridOutline = vtk.vtkRectilinearGridOutlineFilter()
rectGridOutline.SetInputData(rectGridReader.GetOutput())
Explanation: 2. Filters
Filter 1: vtkRectilinearGridOutlineFilter() creates wireframe outline for a rectilinear grid.
End of explanation
rectGridOutlineMapper = vtk.vtkPolyDataMapper()
rectGridOutlineMapper.SetInputConnection(rectGridOutline.GetOutputPort())
Explanation: 3. Mappers
Mapper: vtkPolyDataMapper() maps vtkPolyData to graphics primitives.
End of explanation
outlineActor = vtk.vtkActor()
outlineActor.SetMapper(rectGridOutlineMapper)
outlineActor.GetProperty().SetColor(0, 0, 0)
Explanation: 4. Actors
End of explanation
#Option 1: Default vtk render window
renderer = vtk.vtkRenderer()
renderer.SetBackground(0.5, 0.5, 0.5)
renderer.AddActor(outlineActor)
renderer.ResetCamera()
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)
renderWindow.SetSize(500, 500)
renderWindow.Render()
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renderWindow)
iren.Start()
#Option 2: Using the vtk-viewer for Jupyter to interactively modify the pipeline
vtkSimpleWin = SimpleVtkViewer()
vtkSimpleWin.resize(1000,800)
vtkSimpleWin.hide_axes()
vtkSimpleWin.add_actor(outlineActor)
vtkSimpleWin.add_actor(gridGeomActor)
vtkSimpleWin.ren.SetBackground(0.5, 0.5, 0.5)
vtkSimpleWin.ren.ResetCamera()
Explanation: 5. Renderers and Windows
End of explanation
<END_TASK>