Skip to content

Snippets

Description

Snippets are chunks of code that can be cut (snipped) and pasted into examples. We want each example to be stand-alone, so we do not keep the snippet code in a library.

Available snippets

Snippet Description
CameraOrientationWidget Placement Define the parameters that label, color and position a vtkCameraOrientationWidget.
CameraPosition Output the camera position while moving the image.
CheckVTKVersion Check the VTK version returning true if the requested VTK version is >= the current version.
ChooseContrastingColor Given a color, find a contrasting color. If the given color is "light", use the lightColor otherwise use the darkColor.
DrawViewportBorder Draw the borders of a vtkRenderer's viewports.
Make2DSliderWidget Implement 2D slider widgets.
Permute Permute image and other geometric data to maintain proper orientation regardless of the acquisition order.
PointToGlyph Represent points as glyphs.
ReadPolyData Uses the appropriate vtkPolyData reader to read any vtkPolyData file.
RestoreSceneFromFieldData Restores the saved vtkCamera view from a vtkDataSet's vtkFieldData.
RestoreSceneFromFile Restores the saved vtkCamera view from a file.
SaveSceneToFieldData Stores the current vtkCamera location in a vtkDataSet's vtkFieldData.
SaveSceneToFile Stores the current vtkCamera location in a file.
WriteImage Take a screen shot and save it to a file.