[vtkusers] Display model coordinate with vtkImagePlaneWidget

Dean Inglis dean.inglis at camris.ca
Mon Mar 29 11:26:54 EST 2004


Hi Yang,

>set. The cursor data enabled by vtkCellPicker shows the CELL-coordinate,
but
>I really want to see my model cartesian (X, Y, Z) in the model coordinate
>system. The cell coordinate is mesh (grid) size dependent and gives a
>relative location only. Is there any way to display the model coordinate
>while clicking the left mouse button? Thank you for your help.

vtkIPW has continuous in addition to discrete cursoring abilities.
Continuous cursoring interpolates the discrete cell (voxel) data
so that any point (ie., not the nearest) within the image data bounds
can be interrogated using cell data interpolation.  I based this
functionality
on code found in vtkProbeFilter.cxx.  Discrete cursoring, on the other hand,
provides voxel based coords but the coords are still those of the nearest
data point, in terms of the data extent.  One can still convert this data
to world coords by, for example: x = originx  + spacingx*ix.

In terms of generating model-based coords, one could add an observer
to the widget's InteractionEvent through a suitable callback mechanism that
may contain for example:

<snip>
 vtkImagePlaneWidget *planeWidget =
reinterpret_cast<vtkImagePlaneWidget*>(caller);
 double data[4];
 int result = self->GetCursorData(data);
 if(result)
  {
  //convert your coords: data[0],data[1],data[2] to whatever you need
  }
<snip>

Dean





More information about the vtkusers mailing list