Presentation is loading. Please wait.

Presentation is loading. Please wait.

Scientific Visualization using VTK Ray Gasser IS&T Scientific Visualization Tutorial – Spring 2010.

Similar presentations


Presentation on theme: "Scientific Visualization using VTK Ray Gasser IS&T Scientific Visualization Tutorial – Spring 2010."— Presentation transcript:

1 Scientific Visualization using VTK Ray Gasser rayg@bu.edu IS&T Scientific Visualization Tutorial – Spring 2010

2 VTK Visualization Toolkit –Set of object oriented class libraries for visualization –Several language interfaces Python Tcl C++ Java Visual Basic –Open source –Standards based –Portable –Active developer community –Good documentation available –Professional support services available from Kitware IS&T Scientific Visualization Tutorial – Spring 2010

3 VTK – Getting Started IS&T Scientific Visualization Tutorial – Spring 2010 Unix Shell: katana:% cp -r scivis_workshop/VTK/materials/. katana:% cd materials/Demos/Simple katana:% vtk cone2.tcl

4 VTK - Graphics Model Graphics Model –Transforms graphical data into pictures –Class names adapted from movie industry: lights, camera, actor, props –Consists of the following core objects: vtkActor - object in scene vtkLight - illumination of scene vtkCamera - view of scene vtkProperty - appearance of actor vtkMapper - geometry of actor vtkTransform - positioning of actor, camera, lights vtkLookupTable - defines color tables used in scene vtkRenderer - manages rendering of scene vtkRenderWindow - manages graphics window vtkRenderWindowInteractor - manages keyboard and mouse IS&T Scientific Visualization Tutorial – Spring 2010

5 Code – simple.tcl IS&T Scientific Visualization Tutorial – Spring 2010 Editor: package require vtk vtkRenderWindow renWin renWin SetSize 500 500 vtkRenderer ren1 ren1 SetBackground 0.0 0.0 0.0 renWin AddRenderer ren1 renWin Render Unix Shell: katana:% vtk simple.tcl

6 Exercise1 IS&T Scientific Visualization Tutorial – Spring 2010 Editor: simple2.tcl Change background color to gray

7 Code – Exercise1 IS&T Scientific Visualization Tutorial – Spring 2010 Editor: simple2.tcl package require vtk vtkRenderWindow renWin renWin SetSize 500 500 vtkRenderer ren1 ren1 SetBackground 0.5 0.5 0.5 renWin AddRenderer ren1 renWin Render

8 Code – cone.tcl IS&T Scientific Visualization Tutorial – Spring 2010 Editor: package require vtk vtkConeSource cone cone SetResolution 100 vtkPolyDataMapper coneMapper coneMapper SetInput [cone GetOutput] vtkActor coneActor coneActor SetMapper coneMapper [coneActor GetProperty] SetColor 1.0 0.0 0.0 vtkRenderWindow renWin renWin SetSize 500 500 vtkRenderer ren1 ren1 SetBackground 0.0 0.0 0.0 ren1 AddActor coneActor renWin AddRenderer ren1 renWin Render

9 Code – cone2.tcl IS&T Scientific Visualization Tutorial – Spring 2010 Editor: package require vtk vtkConeSource cone cone SetResolution 100 vtkPolyDataMapper coneMapper coneMapper SetInput [cone GetOutput] vtkActor coneActor coneActor SetMapper coneMapper [coneActor GetProperty] SetColor 1.0 0.0 0.0 vtkRenderWindowInteractor iren vtkRenderWindow renWin renWin SetSize 500 500 vtkRenderer ren1 ren1 SetBackground 0.0 0.0 0.0 ren1 AddActor coneActor renWin AddRenderer ren1 iren SetRenderWindow renWin iren Initialize

10 Exercise2 IS&T Scientific Visualization Tutorial – Spring 2010 Editor: cone3.tcl Add a green cone will need to use: coneActor2 RotateZ 90 coneActor2 SetScale 0.5 0.5 0.5 coneActor2 GetProperty3D SetPosition 1.0 0.0 0.0

11 Code – Exercise 2 IS&T Scientific Visualization Tutorial – Spring 2010 Editor: cone3.tcl... vtkConeSource cone2 cone2 SetResolution 100 vtkPolyDataMapper coneMapper2 coneMapper2 SetInput [cone2 GetOutput] vtkActor coneActor2 coneActor2 SetMapper coneMapper2 [coneActor2 GetProperty] SetColor 0.0 1.0 0.0 coneActor2 RotateZ 90 coneActor2 SetScale 0.5 0.5 0.5 coneActor2 SetPosition 1.0 0.0 0.0 ren1 AddActor coneActor ren1 AddActor coneActor2...

12 VTK - Visualization Model Visualization Model –Transforms information into graphical data –Uses a data flow approach –Two basic types of objects involved vtkDataObject –represents data of various types –consist of geometry and topology (points and cells) and attribute data vtkProcessObject –filters which operate on data objects to produce new data objects –represent visualization algorithms –Data Objects and Process Objects are connected together to form a visualization pipeline Source -> Reader -> Filter -> Mapper -> Actor IS&T Scientific Visualization Tutorial – Spring 2010

13 VTK - Sample Code vtkStructuredGridReader reader reader SetFileName "Data/density.vtk" reader Update vtkContourFilter iso iso SetInputConnection [reader GetOutputPort] iso SetValue 0.26 vtkPolyDataMapper isoMapper isoMapper SetInputConnection [iso GetOutputPort] isoMapper ScalarVisibilityOn vtkActor isoActor isoActor SetMapper isoMapper vtkRenderer ren1 vtkRenderWindow renWin renWin AddRenderer ren1 vtkRenderWindowInteractor iren iren SetRenderWindow renWin ren1 AddActor isoActor renWin SetSize 500 500 renWin Render IS&T Scientific Visualization Tutorial – Spring 2010 Reader Filter Mapper Actor

14 VTK - Readers Polygonal Data Readers –vtkBYUReader - read MOVIE.BYU files –vtkMCubesReader - read binary marching cubes files –vtkOBJReader - read Wavefront (Maya).obj files –vtkPolyDataReader - read VTK polygonal data files –vtkPLYReader - read Standford University PLY polygonal data files –vtkSTLReader - read stereo-lithography files –vtkUGFacetReader - read EDS Unigraphic facet files Image and Volume Readers –vtkBMPReader - read PC bitmap files –vtkDEMReader - read digital elevation model files –vtkJPEGReader - read JPEG files –vtkImageReader - read various image files –vtkPNMReader - read PNM (ppm, pgm, pbm) files –vtkPNGRReader - read Portable Network Graphic files IS&T Scientific Visualization Tutorial – Spring 2010

15 VTK - Readers Image and Volume Readers (cont) –vtkStructuredPointsReader - read VTK structured points data files –vtkSLCReader - read SLC structured points files –vtkTIFFReader - read files in TIFF format –vtkVolumeReader - read image (volume) files –vtkVolume16Reader - read 16-bit image (volume) files Structured Grid Readers –vtkPLOT3DReader - read structured grid PLOT3D files –vtkStructuredGridReader - read VTK structured grid data files Rectilinear Grid Readers –vtkRectilinearGridReader - read VTK rectilinear grid data files Unstructured Grid Readers –vtkUnstructuredGridReader - read VTK unstructured grid data files IS&T Scientific Visualization Tutorial – Spring 2010

16 Characteristics of Data Data is discrete –Interpolation functions generate data values in between known points Structure may be regular or irregular –Regular (structured) need to store only beginning position, spacing, number of points smaller memory footprint per cell (topology can be generated on the fly) examples: image data, rectilinear grid, structured grid –Irregular (unstructured) information can be represented more densely where it changes quickly higher memory footprint (topology must be explicitly written) but more freedom examples: polygonal data, unstructured grid IS&T Scientific Visualization Tutorial – Spring 2010

17 Characteristics of Data Data has a topological dimension –determines methods for visualization –determines data representation –examples: 0D - points 1D - lines/Curves 2D - surfaces 3D - volumes Data is organized into datasets for visualization –Datasets consist of two pieces organizing structure –cells (topology) –points (geometry) data attributes associated with the structure –File format derived from organizing structure IS&T Scientific Visualization Tutorial – Spring 2010

18 Organizing Structure (Topology) Topology –the way in which constituent parts are interrelated or arranged –specified by one or more cells (types vary with visualization packages) vertex - (0D) point polyvertex - (0D) arbitrarily ordered list of points line - (1D) defined by two points polyline - (1D) ordered list of one or more connected lines triangle - (2D) ordered list of three points triangle strip - (2D) ordered list of n + 2 points (n is the number of triangles) polygon - (2D) ordered list of three or more points lying in a plane pixel - (2D) ordered list of four points with geometric constraints quadrilateral - (2D) - ordered list of four points lying in a plane tetrahedron - (3D) ordered list of four nonplanar points voxel - (3D) ordered list of eight nonplanar points with geometric constraints hexahedron - (3D) ordered list of eight nonplanar points IS&T Scientific Visualization Tutorial – Spring 2010

19 VTK Example Cell Types IS&T Scientific Visualization Tutorial – Spring 2010

20 Organizing Structure (Geometry) Geometry –point coordinates assigned to a topology in 3D space –represented by points –example: (0 0 0), (0 1 0), (1 0 0) would be the geometry for a triangle IS&T Scientific Visualization Tutorial – Spring 2010

21 Dataset Types (VTK) Image Data (Structured Points) –regular in both topology and geometry –examples: lines, pixels, voxels –applications: imaging CT, MRI Rectilinear Grid –regular topology but geometry only partially regular –examples: pixels, voxels Structured Grid –regular topology and irregular geometry –examples: quadrilaterals, hexahedron –applications: fluid flow, heat transfer IS&T Scientific Visualization Tutorial – Spring 2010

22 Dataset Types (cont) Unstructured Points –no topology and irregular geometry –examples: vertex, polyvertex –applications: data with no inherent structure Polygonal Data –irregular in both topology and geometry –examples: vertices, polyvertices, lines, polylines, polygons, triangle strips Unstructured Grid –irregular in both topology and geometry –examples: any combination of cells –applications: finite element analysis, structural design, vibration IS&T Scientific Visualization Tutorial – Spring 2010

23 Dataset Types (cont) XML –much more complicated than the dataset types described above, but supports many more features –provides the user with the ability to extend a file format with application specific tags –in VTK the XML dataset has support for compression, portable binary encoding, random access, byte ordering, and multiple file representation of piece data IS&T Scientific Visualization Tutorial – Spring 2010

24 Data Attributes Data attributes associated with the organizing structure –Scalars single valued examples: temperature, pressure, density, elevation –Vectors magnitude and direction examples: velocity, momentum –Normals direction vectors (magnitude of 1) used for shading –Texture Coordinates used to map a point in Cartesian space into 1, 2, or 3D texture space used for texture mapping –Tensors (generalizations of scalars, vectors and matrices) rank 0 ( scalar), rank 1 (vector), rank 2 (matrix), rank3 (3D rectangular array) examples: stress, strain IS&T Scientific Visualization Tutorial – Spring 2010

25 File Format – Structured Grid IS&T Scientific Visualization Tutorial – Spring 2010 Editor density.vtk: # vtk DataFile Version 3.0 vtk output ASCII DATASET STRUCTURED_GRID DIMENSIONS 57 33 25 POINTS 47025 float 2.667 -3.77476 23.8329 2.94346 -3.74825 23.6656 3.21986 -3.72175 23.4982 3.50007 -3.70204 23.3738 3.9116 -3.72708 23.5319 4.1656 -3.69529 23.3312... POINT_DATA 47025 SCALARS Density float LOOKUP_TABLE default 0.498983 0.376668 0.333115 0.311612 0.267114 0.639897 0.479756 0.477011 0.461867 0.428373 0.639897 0.608989 0.570884 0.510595 0.443823 0.407467 0.376066 0.34614... VECTORS Momentum float 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 64.5673 0 0 0 0 0 0 0 0 0 0 0...

26 Color Mapping Scalar Algorithms –Color Mapping maps scalar data to colors implemented by using scalar values as an index into a color lookup table specify a HSVA (Hue-Saturation-Value-Alpha) ramp and then generate the colors in the table by using linear interpolation into the HSVA space. –VTK vtkLookupTable vtkDataSetMapper IS&T Scientific Visualization Tutorial – Spring 2010

27 Code – Color Mapping IS&T Scientific Visualization Tutorial – Spring 2010 Editor: colormap.numcolors.tcl... vtkLookupTable lut lut SetNumberofColors 16 lut SetHueRange 0.0 0.667 lut Build vtkStructuredGridReader reader reader SetFileName “Data/subset.vtk” reader Update vtkDataSetMapper mapper mapper SetInputConnection [reader GetOutputPort] mapper SetLookupTable lut eval mapper SetScalarRange [[reader GetOutput] GetScalarRange] vtkActor actor actor SetMapper mapper...

28 Exercise3 IS&T Scientific Visualization Tutorial – Spring 2010 * Change the number of colors in colormap * Reverse the Hue Range * Change the Scalar Range mapper SetScalarRange 0.0 0.7

29 Contouring Scalar Algorithms (cont) –Contouring construct a boundary between distinct regions, two steps: –explore space to find points near contour –connect points into contour (2D) or surface (3D) 2D contour map (isoline): –applications: elevation contours from topography, pressure contours (weather maps) from meteorology 3D isosurface: 3D isosurface: –applications: tissue surfaces from tomography, constant pressure or temperature in fluid flow, implicit surfaces from math and CAD –VTK vtkContourFilter IS&T Scientific Visualization Tutorial – Spring 2010

30 Code – Contour (isoline) IS&T Scientific Visualization Tutorial – Spring 2010 Editor: contour.single.tcl... vtkStructuredGridReader reader reader SetFileName “Data/subset.vtk” reader Update vtkContourFilter contour contour SetInputConnection [reader GetOutputPort] contour SetValue 0 0.26 vtkPolyDataMapper contourMapper contourMapper SetInputConnection [contour GetOutputPort] eval contourMapper SetScalarRange [[reader GetOutput] GetScalarRange] vtkActor contourActor contourActor SetMapper contourMapper...

31 Code – Contour (isosurface) IS&T Scientific Visualization Tutorial – Spring 2010 Editor: isosurface.tcl... vtkStructuredGridReader reader reader SetFileName “Data/density.vtk” reader Update vtkContourFilter iso iso SetInputConnection [reader GetOutputPort] iso SetValue 0 0.26 vtkPolyDataMapper isoMapper isoMapper SetInputConnection [iso GetOutputPort] eval isoMapper SetScalarRange [[reader GetOutput] GetScalarRange] vtkActor isoActor isoActor SetMapper isoMapper...

32 Scalar Generation Scalar Algorithms (cont) –Scalar Generation extract scalars from part of data example: extracting z coordinate (elevation) from terrain data to create scalar values –VTK vtkElevationFilter IS&T Scientific Visualization Tutorial – Spring 2010

33 Code – Scalar Generation IS&T Scientific Visualization Tutorial – Spring 2010 Editor: hawaii.color.tcl vtkPolyDataReader hawaii hawaii SetFileName "Data/honolulu.vtk" hawaii Update vtkElevationFilter elevation elevation SetInput [hawaii GetOutput] elevation SetLowPoint 0 0 0 elevation SetHighPoint 0 0 1000 elevation SetScalarRange 0 1000 vtkLookupTable lut lut SetHueRange 0.7 0 vtkDataSetMapper hawaiiMapper hawaiiMapper SetInput [elevation GetOutput] hawaiiMapper SetScalarRange 0 1000 hawaiiMapper SetLookupTable lut vtkActor hawaiiActor hawaiiActor SetMapper hawaiiMapper

34 Hedgehogs Vector Algorithms –Hedgehogs oriented scaled line for each vector scale indicates magnitude color indicates magnitude, pressure, temperature, or any variable –VTK vtkHedgeHog IS&T Scientific Visualization Tutorial – Spring 2010

35 Code – HedgeHogs IS&T Scientific Visualization Tutorial – Spring 2010 Editor: hedgehog.tcl vtkStructuredGridReader reader reader SetFileName “Data/density.vtk” reader Update vtkHedgeHog hhog hhog SetInput [reader GetOutput] hhog SetScaleFactor 0.001 vtkPolyDataMapper hhogMapper hhogMapper SetInput [hhog GetOutput] hhogMapper SetLookupTable lut hhogMapper ScalarVisibilityOn eval hhogMapper SetScalarRange [[reader GetOutput] GetScalarRange] vtkActor hhogActor hhogActor SetMapper hhogMapper

36 Oriented Glyphs Vector Algorithms (cont) –Oriented Glyphs orientation indicates direction scale indicates magnitude color indicates magnitude, pressure, temperature, or any variable –VTK vtkGlyph3D IS&T Scientific Visualization Tutorial – Spring 2010

37 Code – Oriented Glyphs IS&T Scientific Visualization Tutorial – Spring 2010 Editor: glyph.tcl vtkArrowSource arrow arrow SetTipResolution 6 arrow SetTipRadius 0.1 arrow SetTipLength 0.35 arrow SetShaftResolution 6 arrow SetShaftRadius 0.03 vtkGlyph3D glyph glyph SetInput [reader GetOutputPort] glyph SetSource [arrow GetOutputPort] glyph SetVectorModeToUseVector glyph SetColorModeToColorByScalar glyph SetScaleModeToDataScalingOff glyph OrientOn glyph SetScaleFactor 0.2 vtkPolyDataMapper glyphMapper glyphMapper SetInput [glyph GetOutput] glyphMapper SetLookupTable lut glyphMapper ScalarVisibilityOn eval glyphMapper SetScalarRange [[reader GetOutput] GetScalarRange]

38 Field Lines Vector Algorithms (cont) –Field Lines Fluid flow is described by a vector field in three dimensions for steady (fixed time) flows or four dimensions for unsteady (time varying) flows Three techniques for determining flow –Pathline (Trace) tracks particle through unsteady (time-varying) flow shows particle trajectories over time rake releases particles from multiple positions at the same time instant reveals compression, vorticity –Streamline tracks particle through steady (fixed-time) flow holds flow steady at a fixed time snapshot of flow at a given time instant –Streakline particles released from the same position over a time interval (time-varying) snapshot of the variation of flow over time example: dye steadily injected into fluid at a fixed point IS&T Scientific Visualization Tutorial – Spring 2010

39 Field Lines Streamlines Lines show particle flow VTK – vtkStreamTracer Streamlets half way between streamlines and glyphs VTK - vtkStreamTracer, vtkGlyph3D Streamribbon rake of two particles to create a ribbon VTK - vtkStreamTracer, vtkRuledSurfaceFilter Streamtube circular rake of particles to create a tube VTK - vtkStreamTracer, vtkTubeFilter IS&T Scientific Visualization Tutorial – Spring 2010

40 Code – Streamlines IS&T Scientific Visualization Tutorial – Spring 2010 Editor: streamLines.tcl vtkPointSource seeds seeds SetRadius 3.0 eval seeds SetCenter [[reader GetOutput] GetCenter] seeds SetNumberOfPoints 100 vtkRungeKutta4 integ vtkStreamTracer streamer streamer SetInputConnection [reader GetOutputPort] streamer SetSourceConnection [seeds GetOutputPort] streamer SetMaximumPropagation 100 streamer SetMaximumPropagationUnitToTimeUnit streamer SetInitialIntegrationStepUnitToCellLengthUnit streamer SetInitialIntegrationStep 0.1 streamer SetIntegrationDirectionToBoth streamer SetIntegrator integ vtkPolyDataMapper mapStreamLines mapStreamLines SetInputConnection [streamer GetOutputPort] eval mapStreamLines SetScalarRange [[reader GetOutput] GetScalarRange] vtkActor streamLineActor streamLineActor SetMapper mapStreamLines

41 Code – Streamtubes IS&T Scientific Visualization Tutorial – Spring 2010 Editor: streamTubes.varyRadius.tcl vtkPointSource seeds seeds SetRadius 1.0 eval seeds SetCenter 1.5 0.01 27 seeds SetNumberOfPoints 50 vtkRungeKutta4 integ vtkStreamTracer streamer streamer SetInputConnection [reader GetOutputPort] streamer SetSourceConnection [seeds GetOutputPort]... vtkTubeFilter streamTube streamTube SetInputConnection [streamer GetOutputPort] streamTube SetRadius 0.01 streamTube SetNumberOfSides 6 # streamTube SetVaryRadiusToVaryRadiusOff streamTube SetVaryRadiusToVaryRadiusByScalar vtkPolyDataMapper mapStreamTube mapStreamTube SetInputConnection [streamTube GetOutputPort] mapStreamTube SetLookupTable lut eval mapStreamTube SetScalarRange [[[[reader GetOutput] GetPointData] GetScalars] GetRange] vtkActor streamTubeActor streamTubeActor SetMapper mapStreamTube [streamTubeActor GetProperty] BackfaceCullingOn

42 Clipping, Cutting, Subsampling Modeling Algorithms - Clipping can reveal internal details of surface VTK - vtkClipDataSet - Cutting/Slicing cutting through a dataset with a surface VTK - vtkCutter - Subsampling reduces data size by selecting a subset of the original data VTK - vtkExtractGrid IS&T Scientific Visualization Tutorial – Spring 2010

43 Code – Clipping IS&T Scientific Visualization Tutorial – Spring 2010 Editor: clipping.tcl vtkStructuredGridReader reader reader SetFileName “Data/density.vtk” reader Update vtkPlane plane eval plane SetOrigin [[reader GetOutput] GetCenter] plane SetNormal -0.287 0 0.9579 vtkClipDataSet clip clip SetInputConnection [reader GetOutputPort] clip SetClipFunction plane clip InsideOutOn vtkDataSetMapper clipMapper clipMapper SetInputConnection [clip GetOutputPort] eval clipMapper SetScalarRange [[reader GetOutput] GetScalarRange] vtkActor clipActor clipActor SetMapper clipMapper

44 Code – Cutplane/Slicing IS&T Scientific Visualization Tutorial – Spring 2010 Editor: cutplane.tcl vtkStructuredGridReader reader reader SetFileName “Data/density.vtk” reader Update vtkPlane plane eval plane SetOrigin [[reader GetOutput] GetCenter] plane SetNormal -0.287 0 0.9579 vtkCutter planeCut planeCut SetInputConnection [reader GetOutputPort] planeCut SetCutFunction plane vtkPolyDataMapper cutMapper cutMapper SetInputConnection [planeCut GetOutputPort] eval cutMapper SetScalarRange [[reader GetOutput] GetScalarRange] vtkActor cutActor cutActor SetMapper cutMapper

45 Annotation Annotation –used for annotating visualization –VTK vtkScalarBarActor vtkTextMapper vtkScaledTextActor IS&T Scientific Visualization Tutorial – Spring 2010

46 Code – colorBar IS&T Scientific Visualization Tutorial – Spring 2010 Editor: colorBar.tcl vtkStructuredGridReader reader reader SetFileName “Data/density.vtk” reader Update vtkScalarBarActor scalarBar scalarBar SetLookupTable lut scalarBar SetTitle "Combustor Density Magnitude" scalarBar SetNumberOfLabels 2 [scalarBar GetPositionCoordinate] SetValue 0.1 0.01 scalarBar SetOrientationToHorizontal scalarBar SetWidth 0.8 scalarBar SetHeight 0.09 vtkRenderer ren1 vtkRenderWindow renWin renWin AddRenderer ren1 vtkRenderWindowInteractor iren iren SetRenderWindow renWin ren1 AddActor streamTubeActor ren1 AddActor outlineActor ren1 AddActor scalarBar ren1 SetBackground 0.5 0.5 0.5

47 VTK - Writers Polygonal Data Writers –vtkBYUWriter - write MOVIE.BYU files –vtkCGMWriter - write 2D polygonal data as a CGM file –vtkIVWriter - write Inventor files –vtkMCubesWriter - write triangles in marching cubes format –vtkPolyDataWriter - write VTK polygonal data files –vtkPLYWriter - write Standford University PLY polygonal data files –vtkSTLWriter - write stereo-lithography files Image and Volume writers –vtkBMPwriter - write PC bitmap files –vtkJPEGwriter - write images in JPEG format –vtkPostscriptWriter – write image files in Postscript format –vtkPNMwriter - write PNM (ppm, pgm, pbm) image files –vtkPNGwriter - write image file in Portable Network Graphic format –vtkTIFFWriter – write image files in TIFF format –vtkStructuredPointsWriter – write a vtkStructuredPoints file IS&T Scientific Visualization Tutorial – Spring 2010

48 Saving Images –common formats: jpeg (lossy) png (lossless) postscript tiff (lossless) –VTK vtkWindowToImageFilter vtkRenderLargeImage IS&T Scientific Visualization Tutorial – Spring 2010

49 Code – Saving Images IS&T Scientific Visualization Tutorial – Spring 2010 Editor: output.tcl renWin Render vtkWindowToImageFilter w2if w2if SetInput renWin w2if Update vtkRenderLargeImage renderLarge renderLarge SetInput ren1 renderLarge SetMagnification 4 #vtkJPEGWriter writer # writer SetInputConnection [w2if GetOutputPort] # writer SetFileName "image.jpg" # writer SetQuality 100 # writer Write #vtkPNGWriter writer # writer SetInputConnection [w2if GetOutputPort] # writer SetFileName "image.png" # writer Write #vtkPostScriptWriter writer # writer SetInputConnection [w2if GetOutputPort] # writer SetFileName "image.ps" # writer Write #vtkTIFFWriter writer # writer SetInputConnection [w2if GetOutputPort] # writer SetFileName "image.tif" # writer Write vtkTIFFWriter writer writer SetInputConnection [renderLarge GetOutputPort] writer SetFileName "largeimage.tif" writer Write

50 VTK - Resources IS&T Scientific Visualization Tutorial – Spring 2010 IS&T tutorials –Using VTK to Visualize Scientific Data http://scv.bu.edu/documentation/tutorials/VTK/ –VTK Examples http://scv.bu.edu/documentation/software- help/scivis/vtk_examples/index.html Texts –The Visualization Toolkit, 4th Edition, Kitware, Inc, 2006. –The VTK User’s Guide, 5th Edition, Kitware, Inc, 2006. Websites –www.vtk.org –www.kitware.com –www.vtk.org/doc/release/5.4/html/classes.html Wiki –www.vtk.org/Wiki/VTK Mailing Lists –www.vtk.org/VTK/help/mailing.html

51 Sources The Visualization Toolkit, 3rd Edition, Will Schroeder, Pearson Education, Inc, 2002. The VTK User’s Guide, 4.2 Edition, Kitware, 2003. Kitware: www.vtk.org IS&T Scientific Visualization Tutorial – Spring 2010


Download ppt "Scientific Visualization using VTK Ray Gasser IS&T Scientific Visualization Tutorial – Spring 2010."

Similar presentations


Ads by Google