Java Examples

Click here for a tutorial on setting up your Java environment.

It would be appreciated if there are any Java VTK experts who could convert any of the c++ examples to Java!

Info

This table shows the VTK classes covered by the examples.

Info

This table shows VTK classes that do not have an example. Please add examples in your area of expertise!

Hello World

Example Name Classes Demonstrated Description Image
A hello world example vtkPolyDataMapper vtkActor vtkRenderer vtkRenderWindow vtkRenderWindowInteractor Cylinder example from the VTK Textbook and source code. A hello world example.

Annotation

Example Name Classes Demonstrated Description Image
TextOrigin vtkTextOrigin TextOrigin
MultiLineText vtkMultiLineText MultiLineText

CompositeData

Example Name Classes Demonstrated Description Image
CompositePolyDataMapper vtkCompositePolyDataMapper CompositePolyDataMapper

Filtering

Example Name Classes Demonstrated Description Image
Delaunay2D vtkDelaunay2D An example to generate set of points and to triangulate using Delaunay2D
Glyph2D vtkGlyph2D Example to copy a polydata to everypoint in the input set.
Glyph3D vtkGlyph3D This example applies an object at every point using vtkGlyph3D

GeometricObjects

Example Name Classes Demonstrated Description Image
Arrow vtkArrow Arrow Visualization
Circle vtkCircle Circle Visualization
Cone vtkCone Cone Visualization
EllipticalCylinder vtkEllipticalCylinder EllipticalCylinder
ConvexPointSet vtkConvexPointSet ConvexPointSet Visualization
Frustum vtkFrustum Frustum Visualization
Disk vtkDiskSource Disk Visualization
Line vtkLineSource Line Visualization
LongLine vtkLine A visualization of a long line
OrientedCylinder vtkOrientedCylinder Oriented Cylinder visualization
OrientedArrow vtkOrientedArrow Oriented Arrow visualization.
Polygon vtkPolygon Polygon Visualization
PlanesIntersection vtkPlanesIntersection PlanesIntersection
RegularPolygonSource vtkRegularPolygonSource RegularPolygon Visualization
ParametricObjects vtkParametricObjects ParametricObjects Visualization
Pyramid vtkPyramid Pyramid Visualization
Quad vtkQuad Quad Visualization
ShrinkCube vtkCubeSource vtkShrinkFilter Applying shrink filter to an object.
Vertex vtkVertex Vertex Visualization
TextActor vtkTextActor TextActor Demonstration
Triangle vtkTriangle Triangle Visualization
TriangleStrip vtkTriangleStrip Triangle Strip Visualization

HyperTreeGrid

Example Name Classes Demonstrated Description Image
HyperTreeGridSource vtkHyperTreeGridSource Demonstration of a hyper-tree grid source.

Geovis

Example Name Classes Demonstrated Description Image
EarthSource vtkEarthSource Earth Source Visualization
CompassWidget vtkCompassWidget CompassWidget Visualization

Graphs

Example Name Classes Demonstrated Description Image
VisualizeGraph vtkMutableUndirectedGraph An example to construct a graph and visualize it.

Images

Example Name Classes Demonstrated Description Image
Actor2D vtkActor2D A actor that draws 2D data
StaticImage vtkImageViewer2 Displays a 2D image

Input and Output

Example Name Classes Demonstrated Description Image
Read a polydata(.vtp) file vtkXMLPolyDataReader IO
Write a polygonal data (.vtp) file vtkXMLPolyDataWriter IO
JPEGWriter vtkJPEGWriter vtkJPEGWriter can be used to write JPEG files

Implicit Functions and Iso-surfaces

Example Name Classes Demonstrated Description Image
ImplicitDataSet Implicit functions, implicit data set.
ImplicitSphere vtkSphere vtkAppendPolyData vtkTubeFilter ImplicitFunctions, Append poly data, tube filter, sphere

Data Structures

Example Name Classes Demonstrated Description Image
VisualizeKDTree vtkKdTreePointLocator Show the levels of a KD Tree.

Image Processing

Example Name Classes Demonstrated Description Image
ImageTest vtkImageReader2Factory use Java File Dialog to select Image File to Display
ShotNoise vtkPNGWriter Example program to write PNG files

Rendering

Example Name Classes Demonstrated Description Image
Cone6 vtkBoxWidget vtkInteractorStyleTrackballCamera This example introduces 3D widgets. 3D widgets take advantage of the event/observer design pattern. Corresponds to the missing Step 6 Java example from VTK/Examples/Tutorial.

Lighting

Example Name Classes Demonstrated Description Image
SpotLight vtkSpotLight vtkSpotLight Demonstration
LightActor vtkLightActor vtkLightActor Demonstration

Parallel

Example Name Classes Demonstrated Description Image
ExodusIIWriter vtkExodusIIWriter Example Program to demonstrates how to use vtkExodusIIWriter

PolyData

Example Name Classes Demonstrated Description Image
Stripper vtkStripper Stripper
KochanekSpline vtkKochanekSpline KochanekSpline
ColorDisconnectedRegions vtkColorDisconnectedRegions ColorDisconnectedRegions
ColoredPoints vtkUnsignedCharArray Example to visualize Colored Points.
Outline vtkOutline Outline
RibbonFilter vtkRibbonFilter RibbonFilter
ColorCells vtkColorCells ColorCells
TubeFilter vtkTubeFilter TubeFilter
ConvexHullShrinkWrap vtkConvexHullShrinkWrap ConvexHullShrinkWrap
MeshQuality vtkMeshQuality MeshQuality
ColorCellsWithRGB vtkColorCellsWithRGB ColorCellsWithRGB
Reflection vtkReflection Reflection
Example Name Classes Demonstrated Description Image
AVI vtkAVIWriter An example to demonstrate how to make an AVI video using vtkAVIWriter
Example Name Classes Demonstrated Description Image
RenderView vtkRenderView An easier way to make objects appear on the screen using RenderView

Utilities

Example Name Classes Demonstrated Description Image
FullScreen vtkRenderWindow Example to Display Actors in a Full Screen Render Window
TimerLog vtkTimerLog Example to Demonstrate Timer support and logging.

Visualization

Example Name Classes Demonstrated Description Image
AnimDataCone vtkRenderWindowInteractor Animate a cone by modifying the polydata points - uses Interaction M key (Motion) to toggle animation.
Animation Move a sphere across a scene
BackgroundColor Example program to set the background color of the render window
BackgroundGradient viewport having gradient background using the Background (bottom) and Background2 (top) colors.
ColorAnActor vtkActor vtkCanvas Switch style interaction adds C and A key actions for selecting Camera or Actor interaction, and T and J key actions for Trackball or Joystick interaction mode. Adds charEvent observer callback to restore the missing E and Q events to quit.
Cursor2D vtkCursor2D Generates a 2D Cursor Representation.
Cursor3D vtkCursor3D Generates a 3D Cursor Representation
Cutter vtkCutter How to use vtkCutter by cutting through a cube.
Follower vtkFollower Draw text that stays right side up.
VectorFieldExample vtkXMLUnstructuredGridReader, vtkThresholdPoints, vtkGlyph3D A vector field visualisation.
WireframeSphere vtkSphere A Wireframe Sphere Visualization.

Graphs

Example Name Classes Demonstrated Description Image
SelectGraphVertices vtkAnnotationLink Select Edges and vertices in a graph

SimpleOperations

Example Name Classes Demonstrated Description Image
DistanceBetweenPoints vtkMath Example Program to find squared distance and the Euclidean distance between two 3D points.
PerspectiveTransform vtkPerspectiveTransform It is used to describe the full range of homogeneous transformations. It was designed in particular to describe a camera-view of a scene

Swing Integration

Example Name Classes Demonstrated Description Image
JFrameRender vtkRenderWindowPanel Render a scene in a JFrame using a vtkRenderWindowPanel
SwingHandleMouseEvent vtkRenderWindowPanel Display in a JLabel the point the mouse is hovering over using a mouse listener

Widgets

Example Name Classes Demonstrated Description Image
AngleWidget vtkAngleWidget AngleWidget Demonstration
AngleWidget2D vtkAngleWidget2D AngleWidget2D Demonstration
BalloonWidget vtkBalloonWidget The balloon text describes each object when you hover it.
PlaneWidget vtkPlaneWidget A finite (bounded) plane that can be interactively placed in a scene.
SplineWidget vtkSplineWidget SplineWidget Demonstration