Download - 3D Visualization for Matlab
![Page 1: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/1.jpg)
matVTK
3D Visualization for Matlab
Erich Birngruber, René Donner, Georg Langs
Computational Image Analysis and Radiology LabMedical University of Vienna, Austria
http://www.cir.meduniwien.ac.at/
CSAIL, Massachusetts Institute of Technology, USA
Dienstag, 29. September 2009
![Page 2: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/2.jpg)
Motivation
2
Previous work
• Gobbi et al. 2008: Simulink Libraries for Visual Programming of VTK and ITK
Need
• Work on (large) medical datasets
• Need for “visual debugging” / big picture
• Easy usability for the Matlab userExample from work of S. Witoszynskyj
Dienstag, 29. September 2009
![Page 3: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/3.jpg)
Motivation
Matlab
• Rapid prototyping / algorithm development
• Limited visualization for 3D data
3
Dienstag, 29. September 2009
![Page 4: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/4.jpg)
Motivation
Matlab
• Rapid prototyping / algorithm development
• Limited visualization for 3D data
VTK
• Powerful, good performance
• Platform independent
3
Dienstag, 29. September 2009
![Page 5: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/5.jpg)
Outline
• Development foundations
• Resulting Framework
• Use cases
Dienstag, 29. September 2009
![Page 6: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/6.jpg)
Foundations
• Mex interface allows access to C/C++ libs
- Use Matlab memory managment
- Mex entry point function
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[]){ ... }
• VTK “pipes & filters” concatenate data processing
5
Dienstag, 29. September 2009
![Page 7: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/7.jpg)
Obstacles
• Keeping state:
no direct support for handles in Mex
• VTK rendering loop interferes with Matlab
6
Dienstag, 29. September 2009
![Page 8: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/8.jpg)
matVTK Framework
• Handle based:
implicit creation, automatic destruction
• Imitates Matlab plot commands:
prefixed with vtk...
vtkplotpoints(pointset)
vtkquiver(points, vectors)
7
Dienstag, 29. September 2009
![Page 9: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/9.jpg)
Parameters
• No code generation: explicit mapping
• Easily extendable
• Basic settings mapping:
8
Dienstag, 29. September 2009
![Page 10: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/10.jpg)
Parameters
• No code generation: explicit mapping
• Easily extendable
• Basic settings mapping:
VTKscalar valuetriplet valuedifferent modes (Constants)
8
Dienstag, 29. September 2009
![Page 11: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/11.jpg)
Parameters
• No code generation: explicit mapping
• Easily extendable
• Basic settings mapping:
VTKscalar valuetriplet valuedifferent modes (Constants)
mapping
8
Dienstag, 29. September 2009
![Page 12: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/12.jpg)
Parameters
• No code generation: explicit mapping
• Easily extendable
• Basic settings mapping:
VTKscalar valuetriplet valuedifferent modes (Constants)
Matlab5[1, 2, 3]“String”
mapping
8
Dienstag, 29. September 2009
![Page 13: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/13.jpg)
matVTK Framework
9
Matlab
VTK
Input
Data
Numeric
Output
Handle
Graphic primitives
points
lines
surfaces
volumes
Algorithms
triangulation
pointselection
Visual
output
Function
callsHandle
Dienstag, 29. September 2009
![Page 14: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/14.jpg)
Primitives
10Example from work of E. Dittrich
Dienstag, 29. September 2009
![Page 15: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/15.jpg)
Primitives
• Points
10Example from work of E. Dittrich
Dienstag, 29. September 2009
![Page 16: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/16.jpg)
Primitives
• Points
10
• Lines
Example from work of E. Dittrich
Dienstag, 29. September 2009
![Page 17: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/17.jpg)
Primitives
• Points
10
• Lines
• Volumes
• Meshes (surfaces)
Example from work of E. Dittrich
Dienstag, 29. September 2009
![Page 18: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/18.jpg)
Primitives
• Points
10
• Lines
• Volumes
• Meshes (surfaces)
• Vectors (as arrows)
Example from work of E. Dittrich
Dienstag, 29. September 2009
![Page 19: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/19.jpg)
Primitives
• Points
10
• Lines
• Volumes
• Meshes (surfaces)
• Vectors (as arrows)
• Tensors
Example from work of E. Dittrich
Dienstag, 29. September 2009
![Page 20: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/20.jpg)
Combining Primitives
• Combinations of primitives can construct complex scenes
11
Example from work of E. Schwartz
Dienstag, 29. September 2009
![Page 21: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/21.jpg)
Additional Functionality
• Widgets for data inspection & annotation
• Cropping
• Labels
• Axes
• Data export
• Restore scenes
12
Dienstag, 29. September 2009
![Page 22: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/22.jpg)
Example
% plot and save components to handlehv = vtkplotvolume(volume,‘SoftSkin’)hm = vtkplotmesh(vertices, faces ‘color’, [0 0 1])% crop volume and mesh with plane widgetvtkcrop(hv, ‘plane’)vtkcrop(hm)% show axesvtkgrid% interactive display, free resourcesvtkshowvtkdestroy
13
Dienstag, 29. September 2009
![Page 23: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/23.jpg)
Example
% plot and save components to handlehv = vtkplotvolume(volume,‘SoftSkin’)hm = vtkplotmesh(vertices, faces ‘color’, [0 0 1])% crop volume and mesh with plane widgetvtkcrop(hv, ‘plane’)vtkcrop(hm)% show axesvtkgrid% interactive display, free resourcesvtkshowvtkdestroy
13
Dienstag, 29. September 2009
![Page 24: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/24.jpg)
Performance
100 130 160 190 220 2500
10
20
30
40
50
60
70
cube sidelength
se
cs
matVTK
Matlab
Isosurfacing for different volume sizes14
Dienstag, 29. September 2009
![Page 25: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/25.jpg)
Availability
• Developed on MacOS X 10.5
• Linux 32bit, 64bit
• Windows XP, Vista, 7
15
as platform independent as Matlab and VTK
Dienstag, 29. September 2009
![Page 26: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/26.jpg)
Outlook
• Streaming visualization
• Saving widget states
• Remove scene objects
• Event recording / movies
16
Example from work of G. Langs
Dienstag, 29. September 2009
![Page 27: 3D Visualization for Matlab](https://reader030.vdocument.in/reader030/viewer/2022012711/61aacdd3f26220640444b994/html5/thumbnails/27.jpg)
Thanks
• Available online:
http://www.cir.meduniwien.ac.at/matvtk/
• Feedback and ideas [email protected]
17
Dienstag, 29. September 2009