Difference between revisions of "SciVisFall2007/VTK Tips"

From VistrailsWiki
Jump to navigation Jump to search
 
Line 1: Line 1:
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.
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 ===
=== 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'''.
'''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'''. Also, please remember to read the documentation provided in the different packages.


=== Tcl tips ===
=== Tcl tips ===

Latest revision as of 15:23, 17 September 2007

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. Also, please remember to read the documentation provided in the different packages.

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.