Personal tools
  • Help

draw3d:MainPage

From NITRC Wiki

Jump to: navigation, search

Contents

Introduction

Draw3D is a 3D rendering tool written entirely in VTK-TCL script. It is intended for fast command line rendering and visual inspection of datasets commonly found in medical imaging. It also allows the generation of images for reports or videos. The interactive rendering is controlled by a VTK interactor - documentation for how to interact with it is found here. http://www.vtk.org/doc/nightly/html/classvtkInteractorStyle.html

As it is based on VTK, it can render whatever VTK can render, and runs wherever VTK can run. The author uses it on Windows and Linux pretty regularly. Reports of its results on MacOS would be appreciated.

Meshinator is a simpler tool that uses VTKs isosurface functions to generate meshes from volumetric data.

Known bugs:

The initial window level for the planes widgets is sometimes correct and sometimes incorrect. It can be adjusted manually clicking and dragging the right button within the plane widget.

For volume images not placed at the origin of the coordinate system, the image may be drawn at the wrong place. Meshinator may also create a mesh that needs to be translated to the actual position of the data. This is due to VTK not supporting a coordinate system for images.

Installation and use:

Draw3d and meshinator are scripts that should be run by the VTK interpreter. To achieve this, a small shell script (unix) or batch file (windows) can be placed in the path that calls the vtk interpreter, and the draw3d script. Examples of these files are included in the source, you will have to adjust your paths according to the configuration of your system.

A fairly detailed help can be obtained by doing

draw3d help

The output of this is reproduced here - the help in the code may be more up to date than this web site.

Meshinator has far fewer options, which can be listed by running it with no arguments

meshinator

The help is reproduced here

Gallery of Examples:

These examples use the example data provided with the source.  In the examples below, the scripts are fed to the vtk interpreter directly.  As mentioned in the installation section, you may wish to set up a small script in your path to do this for you.

Meshinator

The isosurface mesh provided in the examples was created in meshinator using the following commands:

vtk src/meshinator.tcl example/brainweb1e1a10f20.mha

will show the result for interactive use, like this, while:

Image:Snap5.png

vtk src/meshinator.tcl example/brainweb1e1a10f20.mha auto 0.95 example/brainweb1e1a10f20.vtk

outputs the vtk file to disk.  You could also save the vtk file from the interactive case by using the write button.

Draw3D

The following are several examples of using draw3D

1. A fairly simple mesh and image display

vtk src/draw3d.tcl polydata example/brainweb1e1a10f20.vtk planes example/brainweb1e1a10f20.mha

Image:Draw3d:Snap1.png

)

2. A more complex scene, with mesh, image, geometric objects and control of drawing parameters like color.

vtk src/draw3d.tcl  opacity 0.1 color "0.5 0.5 0" polydata example/brainweb1e1a10f20.vtk \
                    planes example/roi.mha red outline example/roi.mha \
                    green points example/randompoints.dat purple lines example/lineofpoints.dat

Image:Snap2.png

The same, but with the "3" key pressed to give an anaglyphic 3d view

Image:Snap3.png

3. The first example again, using opacity.  The opacity is as provided by the vtk rendering library.  It is not always perfect.

vtk src/draw3d.tcl  opacity 0.5 polydata example/brainweb1e1a10f20.vtk planes example/brainweb1e1a10f20.mha

Image:Snap4.png

Powered by MediaWiki
  • This page was last modified 11:08, 30 March 2011.
  • This page has been accessed 1,937 times.
  •