VisTrails Home

SciVisFall2007/VTK Tips

From VisTrailsWiki

Revision as of 12:48, 16 September 2007 by Cscheid (Talk | contribs)
Jump to: navigation, search

Here are some tips to help converting VTK scripts to VisTrails pipelines. Most of these can be figured out by careful study of the class slides, so you should try doing that first.

General tips

Do not be afraid to experiment. Both the module and method widgets are searchable. Type what you are looking for and see if it's there. Try to execute pipelines. If they don't work, check if you connected everything. Check if the connections are set to the right ports. Check if you set the correct file names. Look at the examples that are provided with the VisTrails distribution and with the course notes.

Tcl tips

Function parameters are separated by spaces:

sample SetSampleDimensions 20 20 20

is equivalent to

sample.SetSampleDimensions(20, 20, 20);

in Python, C, C++, Java, etc.

Expressions between square brackets are similar to function calls - they are evaluated to the result of the internal expression. So the line

clip SetInput [sample GetOutput]

is calling the method SetInput with the result of calling GetOutput on sample.

VTK tips

Calls to SetInput and GetOutput are (typically) connections which should be created with the ports AddInputConnection and GetOutputPort.

Some expressions do not have direct translations. Use the VisTrails interface to help you. For example, GetProperty is referring to a vtk property. Now look around to see if there is anything similar to a property that you can drag down to the pipeline (there is). Now see if you can connect that to the actor (you can).

There is no vtkRenderWindow on VisTrails. Look at the examples.

Personal tools