from IPython.display import Image
Image(filename='Figs_ipandcg_2014/2014_Session_4.png')
During this laboratory session you will acquaint with basic capabilities of the Visualization Toolkit (VTK) library. The VTK is an open-source, freely available software system for 3D computer graphics, image processing and visualization. VTK is cross-platform and runs on Linux, Windows, Mac and Unix platforms.
Process of generation of 2D and 3D images using the computers is called rendering. At first, a data are transformed into a graphical form and then rendered. Physical generation of an image is based on the reflection of light rays from the surface of objects. The object will be visible only when the reflected rays hit the eye. In reality this may work because light sources are generating enormous amount of light. Simulation of this process is almost impossible to implement, so we use other rendering techniques that can be divided into two types:
During the image-order rendering each pixel of object is painted separately (e.g. ray-tracing, where each ray of light is traced separately). In the object-order thype the whole objects (actors) are rendered in the scene at the same time (simultaneously) in a certain order: left to right, top to bottom. We should also pay attention to the objects that don't have surface, such as clouds or fog. In this case we have to consider the changing light properties inside of this objects.
We can distinguish 3 primary rendering process components: sources of light, rendered objects (that we referred to as actors) and camera. The simplest type of light sources is the infinitely distant, point light source that emits parallel light rays in all directions.
The way that the 3D scene can be seen depends on: camera:
There are two projection methods:
In orthographic method rays of light entering the camera are parallel to the projection vector. In the second case light rays go through a common point. Front clipping plane is used to eliminate objects that are too close to the camera and back clipping plane to eliminate to far objects.
An actor to be shown in scene has to be modeled. In practice, objects are represented by combination of primitives forms like points, lines, polygons, curves and splines of various forms.
There are seven basic objects that we use to render a scene. Documentation of all objects and classes used in vtk library is available on the webpage: http://www.vtk.org/doc/release/6.1/html/classes.html.
from IPython.display import Image
Image(filename='Figs_ipandcg_2014/4_cone.png')
from IPython.display import Image
Image(filename='Figs_ipandcg_2014/4_triangle1.png')
from IPython.display import Image
Image(filename='Figs_ipandcg_2014/4_triangle2.png')
from IPython.display import Image
Image(filename='Figs_ipandcg_2014/4_sphere.png')
from IPython.display import Image
Image(filename='Figs_ipandcg_2014/4_sphere_and_cylinder.png')
Use other objects e.g.: vtkArrowSource, vtkTextCource, vtkDiskSource,vtkEarthSource, tkTexturedSphereSource, vtkPlaneSource,...
add actors to the rendreres (AddActor(...))
from IPython.display import Image
Image(filename='Figs_ipandcg_2014/4_renderers.png')
from IPython.display import Image
Image(filename='Figs_ipandcg_2014/4_blood1.png')
from IPython.display import Image
Image(filename='Figs_ipandcg_2014/4_warp_image.png')
from IPython.display import Image
Image(filename='Figs_ipandcg_2014/4_marching_cubes.png')
from IPython.display import Image
Image(filename='Figs_ipandcg_2014/4_vtk_wx.png')