[vtkusers] Display model coordinate with vtkImagePlaneWidget

Xianjin Yang Yang at AGIUSA.COM
Mon Mar 29 11:38:51 EST 2004


Hi Dean,

Thank you for your prompt and helpful response. It is unfortunate that the
continuous cursoring is found in vtk4.4 and up, but I could not make my BCB6
project to work with vtk4.4. I am still using vtk4.2. This may be another
sign to abandon BCB.

Thank a lot.

Yang


-----Original Message-----
From: Dean Inglis [mailto:dean.inglis at camris.ca] 
Sent: Monday, March 29, 2004 10:27 AM
To: vtkusers archive
Cc: Yang at AGIUSA.COM
Subject: Re: [vtkusers] Display model coordinate with vtkImagePlaneWidget 


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040329/7450b6ed/attachment.htm>


More information about the vtkusers mailing list