<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: [vtkusers] Display model coordinate with vtkImagePlaneWidget </TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Hi Dean,</FONT>
</P>

<P><FONT SIZE=2>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.</FONT></P>

<P><FONT SIZE=2>Thank a lot.</FONT>
</P>

<P><FONT SIZE=2>Yang</FONT>
</P>
<BR>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Dean Inglis [<A HREF="mailto:dean.inglis@camris.ca">mailto:dean.inglis@camris.ca</A>] </FONT>
<BR><FONT SIZE=2>Sent: Monday, March 29, 2004 10:27 AM</FONT>
<BR><FONT SIZE=2>To: vtkusers archive</FONT>
<BR><FONT SIZE=2>Cc: Yang@AGIUSA.COM</FONT>
<BR><FONT SIZE=2>Subject: Re: [vtkusers] Display model coordinate with vtkImagePlaneWidget </FONT>
</P>
<BR>

<P><FONT SIZE=2>Hi Yang,</FONT>
</P>

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

<P><FONT SIZE=2>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.&nbsp; I based this functionality on code found in vtkProbeFilter.cxx.&nbsp; 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.&nbsp; One can still convert this data to world coords by, for example: x = originx&nbsp; + spacingx*ix.</FONT></P>

<P><FONT SIZE=2>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:</FONT></P>

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

<P><FONT SIZE=2>Dean</FONT>
</P>

</BODY>
</HTML>