vtk the visualiza on toolkit
play

VTK: The Visualiza.on Toolkit Part I: Overview and - PowerPoint PPT Presentation

VTK: The Visualiza.on Toolkit Part I: Overview and Graphics Models Han-Wei Shen The Ohio State University What is VTK? An open


  1. VTK: ¡The ¡Visualiza.on ¡Toolkit ¡ Part ¡I: ¡Overview ¡and ¡ ¡Graphics ¡Models ¡ Han-­‑Wei ¡Shen ¡ ¡ The ¡Ohio ¡State ¡University ¡

  2. What ¡is ¡VTK? ¡ ¡ • An ¡open ¡source, ¡freely ¡available ¡ soIware ¡system ¡for ¡3D ¡ graphics, ¡image ¡processing, ¡and ¡ visualiza.on. ¡ ¡ • Support ¡for ¡hundreds ¡of ¡ algorithms ¡in ¡visualiza.on ¡and ¡ image ¡processing ¡ ¡ • Object-­‑oriented ¡design ¡with ¡ different ¡interpreted ¡language ¡ wrappers. ¡ ¡

  3. At ¡a ¡Glance ¡ ¡ ¡ • The ¡core ¡of ¡VTK ¡ ¡is ¡wriQen ¡en.rely ¡in ¡C++ ¡and ¡ contains ¡hundreds ¡of ¡classes ¡ ¡ • VTK ¡ ¡compiles ¡and ¡run ¡on ¡Windows, ¡MacOS, ¡Linux ¡ ¡ • Different ¡interfaces ¡for ¡fast ¡prototyping: ¡Tcl/Tk, ¡ Java, ¡and ¡ ¡Python ¡ • Have ¡users ¡all ¡over ¡the ¡world ¡– ¡The ¡beauty ¡of ¡ Open ¡Source! ¡ ¡

  4. System ¡Architecture ¡ Interpreted Wrapper (Tcl, Java, Python) • Tcl/Tk shell • Tcl/Tk source • Java interpreter • Java JDK • Python interpreter • Python source C++ core All class source code Libraries and includes (could take hours to (dll and .h files) compile) Or (.a and .h files) Binary Installation: if you will use Source code Installation: The classes to build your applicatoin If you want to extend vtk

  5. VTK ¡classes ¡ (http://www.vtk.org/doc/nightly/html/classes.html)

  6. VTK ¡ ¡Object ¡Models ¡ • Graphics ¡and ¡Visualiza.on ¡Models ¡ – Graphics ¡objects: ¡rendering ¡ – Visualiza.on ¡objects: ¡genera.ng ¡graphical ¡ objects ¡to ¡represent ¡the ¡data ¡ ¡ Data Flow System: Pipeline execution Visualization Data source Graphics

  7. Pipeline ¡Execu.on ¡ Direction of data flow Visualization model Graphics model Source Filter Mapper Actor Renderer Direction of ‘update’

  8. VTK ¡Mappers ¡ ¡ • Mappers ¡convert ¡data ¡into ¡graphical ¡primi.ves ¡or ¡write ¡to ¡a ¡ file ¡(writer) ¡ – Mappers ¡require ¡one ¡or ¡more ¡input ¡data ¡objects ¡ – Mappers ¡terminate ¡the ¡visualiza.on ¡pipeline ¡ • Example: ¡vtkPolyDataMapper, ¡which ¡takes ¡geometry ¡such ¡as ¡ cylinder ¡or ¡cone ¡as ¡input ¡and ¡convert ¡it ¡to ¡renderable ¡ geometry ¡ ¡ Visualization model Graphics model Source Filter Mapper Actor Renderer

  9. VTK ¡Actors ¡ • Actors ¡represent ¡graphical ¡data ¡or ¡objects ¡ • A ¡VTK ¡actor ¡contains ¡ – ¡ object ¡proper.es ¡(color, ¡shading ¡type, ¡etc) ¡ – ¡geometry ¡ – transforma.ons ¡ • VTK ¡actors ¡need ¡to ¡work ¡together ¡with ¡lights ¡(vtkLight) ¡and ¡ camera ¡(vtkCamera) ¡to ¡make ¡a ¡scene ¡ ¡ • The ¡scene ¡is ¡then ¡rendered ¡to ¡an ¡image ¡by ¡a ¡renderer ¡ (vtkRenderer) ¡ ¡ Visualization model Graphics model Source Filter Mapper Actor Renderer

  10. VTK ¡Renderer ¡ ¡ • The ¡Renderer ¡in ¡VTK, ¡vtkRenderer, ¡is ¡to ¡coordinate ¡ the ¡rendering ¡process ¡that ¡involves ¡lights, ¡cameras, ¡ and ¡actors ¡ ¡ • vtkRenderer ¡creates ¡a ¡default ¡camera ¡and ¡ ¡lights ¡if ¡ not ¡present, ¡but ¡needs ¡to ¡have ¡at ¡least ¡one ¡actor ¡ • vtkRenderer ¡needs ¡to ¡be ¡connected ¡with ¡a ¡ vtkRenderWindow ¡ ¡ ¡ ¡ Visualization model Graphics model Source Filter Mapper Actor Renderer

  11. VTK ¡Render ¡Window ¡ • The ¡class, ¡vtkRenderWindow ¡.es ¡the ¡en.re ¡ rendering ¡process ¡together ¡ ¡ • It ¡manages ¡all ¡the ¡pla`orm ¡dependent ¡window ¡ management ¡issues ¡and ¡hide ¡the ¡details ¡from ¡the ¡ user ¡ ¡ • It ¡also ¡stores ¡graphics ¡specific ¡informa.on ¡such ¡as ¡ window ¡size, ¡posi.on, ¡.tle, ¡frame ¡buffer ¡depth, ¡etc. ¡ ¡ Visualization Graphics model model Filter Mapper Renderer Source Actor Render window

  12. The ¡Graphics ¡Model ¡ camera Actor Light screen Viewer

  13. The ¡Graphics ¡Model ¡ camera Actor Light vtkCamera screen Viewer

  14. The ¡Graphics ¡Model ¡ camera Actor Light vtkCamera vtkActor screen • vtkProperty • vtkMapper • vtkTransform Viewer

  15. The ¡Graphics ¡Model ¡ camera Actor Light vtkCamera vtkActor vtkLight screen • vtkProperty • vtkMapper • vtkTransform Viewer

  16. The ¡Graphics ¡Model ¡ camera Actor Light vtkCamera vtkActor vtkLight screen • vtkProperty • vtkMapper • vtkTransform vtkRenderer Viewer

  17. The ¡Graphics ¡Model ¡ The purpose is to render the geometry (volume) on the screen camera Actor Light vtkCamera vtkActor vtkLight screen • vtkProperty • vtkMapper vtkRenderWindow • vtkTransform vtkRenderer vtkRenderWindowInteractor Viewer

  18. VTK ¡Simple ¡Pseudo ¡Code ¡ Main() { create geometry; create a mapper; give the geometry to the mapper; create an actor; give the mapper to the actor; create a renderer; give the actor to the renderer; create a window; give the renderer to the window; window->render(); }

  19. VTK ¡Simple ¡Pseudo ¡Code ¡ Geometry Main() { create geometry; create a mapper; give the geometry to the mapper; create an actor; give the mapper to the actor; create a renderer; give the actor to the renderer; create a window; give the renderer to the window; window->render(); }

  20. VTK ¡Simple ¡Pseudo ¡Code ¡ Geometry Main() { create geometry; create a mapper; Mapper give the geometry to the mapper; create an actor; give the mapper to the actor; create a renderer; give the actor to the renderer; create a window; give the renderer to the window; window->render(); }

  21. VTK ¡Simple ¡Pseudo ¡Code ¡ Geometry Main() { create geometry; create a mapper; Mapper give the geometry to the mapper; create an actor; give the mapper to the actor; Actor create a renderer; give the actor to the renderer; create a window; give the renderer to the window; window->render(); }

  22. VTK ¡Simple ¡Pseudo ¡Code ¡ Geometry Main() { create geometry; create a mapper; Mapper give the geometry to the mapper; create an actor; give the mapper to the actor; Actor create a renderer; give the actor to the renderer; Renderer create a window; give the renderer to the window; window->render(); }

  23. VTK ¡Simple ¡Pseudo ¡Code ¡ Geometry Main() { create geometry; create a mapper; Mapper give the geometry to the mapper; create an actor; give the mapper to the actor; Actor create a renderer; give the actor to the renderer; Renderer create a window; give the renderer to the window; Window window->render(); }

  24. VTK ¡Simple ¡Pseudo ¡Code ¡ Geometry Main() { create geometry; create a mapper; Mapper give the geometry to the mapper; create an actor; give the mapper to the actor; Actor create a renderer; give the actor to the renderer; Renderer create a window; give the renderer to the window; Window window->render(); }

  25. VTK ¡Render ¡a ¡Cone ¡ #include ¡“vtk.h” ¡ ¡ Main() ¡ ¡ { ¡ Geometry ¡ ¡ ¡ ¡ ¡vtkConeSource ¡*cone ¡= ¡vtkConeSource::New(); ¡ ¡ ¡ ¡ ¡ ¡ ¡cone-­‑>SetResolu.on(8); ¡ ¡ ¡ vtkPolyDataMapper ¡*mapper ¡= ¡vtkPolyDataMapper::New(); ¡ ¡ Mapper ¡ ¡ ¡ ¡ ¡mapper ¡-­‑>SetInput(cone-­‑>GetOutput()); ¡ ¡ ¡ ¡ ¡ ¡vtkActor ¡*coneActor ¡= ¡vtkActor::New(); ¡ ¡ Actor ¡ ¡ ¡ ¡ ¡coneActor-­‑>SetMapper(Mapper); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡vtkRenderer ¡* ¡ren ¡= ¡vtkRenderer::New(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ren-­‑>AddActor(conActor); ¡ ¡ Renderer ¡ ¡ ¡ ¡ ¡vtKRenderWindow ¡*renWindow ¡= ¡vtkRenderWindow::New(); ¡ ¡ ¡ ¡ ¡ ¡ ¡renWindow-­‑>AddRenderer(ren); ¡ ¡ Window ¡ ¡ ¡ ¡ ¡renWindow-­‑>render(); ¡ } ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend