[vtk-developers] vtkContourWidget/vtkContourRepresentation and coordinate system confusion?

kent williams nkwmailinglists at gmail.com
Tue Mar 4 17:33:10 EST 2008

I'm having a devil of a time sorting out a display issue:

I'm using the vtkinria3d vtkViewImage2D class to display a brain
volume in 3 orthogonal views.  The vtkinria3d::vtkViewImage2D class is
a not-quite-drop-in replacement for vtkImageViewer2, which is flexible
in terms of event handling, and allows multiple views to automatically
synchronize during navigation.

The problem I'm having is this:  I want to trace on one view (e.g.
Sagittal) and update the intersection between the tracing in other
views, displayed relative to different planes.
To this end I'm using vtkViewImage2D::AddPolyData, which does the
heavy lifting of setting up an mapper and actor to display geometry.
What it asks for is an instance of vtkPolyData in 'world coordinates'
and then it clips it so that it displays the intersection with the
current view plane.

Here's my questions:

1. vtkContourRepresentation::GetContourRepresentationAsPolyData
appears to return its points 'in world coordinates' -- at least the
points appear to be in the same coordinate system as the points
returned by vtkContourRepresentation::GetNthNodeWorldPosition.  But
_which_ world coordinates -- positions in the display volume, based on
the vtkImageData's origin and spacing, assuming the origin is where?
at IJK == 0,0,0? At the center of the image? at the center of the
display? Is spacing incorporated into those world positions?

The obvious problem with the GetNthNodeWorldPosition is that the Z
coordinate is zero, no matter what orientation you're tracing in.

2. You can ask the vtkImageData instance what its origin and spacing
are, but how do you know what this means? Does vtk keep track of the
image orientation in some standard frame e.g. anatomical space?

The problem is that I can't figure out how to get
vtkinria3d::vtkViewImage2D to display vtkPolyData properly.  It will
display it -- sort of, but not at the correct position. It seems to be
offset in one dimension or another well away from the anatomy being

More information about the vtk-developers mailing list