<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hello VTK users,<BR>
&nbsp;<BR>
I'm using a visualization pipeline as the following:<BR>
&nbsp;<BR>
vtkImageData-&gt;vtkImageReslice-&gt;...-&gt;vtkImageActor<BR>
&nbsp;<BR>
for a multi-planar rendering of CT image and use vtkCursor2D to&nbsp;display the focus point by first converting the display coordinate to world coordinate in vtkImageData:<BR>
&nbsp;<BR><FONT size=2>
vtkRenderer&amp; rndr = *interactor-&gt;GetRenderWindow()-&gt;GetRenderers()-&gt;GetFirstRenderer();<BR>
rndr.SetDisplayPoint(currPos[0], currPos[1], 0);<BR>
rndr.DisplayToWorld();<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>double</FONT></FONT><FONT size=2> point[4];<BR>
rndr.GetWorldPoint(point);<BR>
</FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// the value in the third component is fake, why???<BR></FONT></FONT><FONT size=2>
</FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>//point[2] = 0.0;<BR></FONT></FONT><FONT size=2>
</FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// next, convert back to the original vtkImageData coordinate system<BR></FONT></FONT><FONT size=2>
vtkImageReslice* reslice = ImageReslice;<BR>
reslice-&gt;GetOutput()-&gt;UpdateInformation();<BR>
vtkImageData&amp; slice = *reslice-&gt;GetOutput();<BR>
vtkMatrix4x4 *matrix = reslice-&gt;GetResliceAxes();<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>double</FONT></FONT><FONT size=2> center[4];<BR>
matrix-&gt;MultiplyPoint(point, center);<BR>
</FONT><FONT color=#008000 size=2><FONT color=#008000 size=2></FONT></FONT><FONT size=3>&nbsp;</FONT><BR>
<FONT size=3></FONT>&nbsp;<BR>
<FONT size=3></FONT>&nbsp;<BR>
Then convert it back screen coordinate to vtkCursor2D (this is neccessary to synchronize the multiple views). In the following, "center" is the world coordinate based on vtkImageData.<BR>
&nbsp;<BR><FONT size=2>
vtkMatrix4x4* invert = vtkMatrix4x4::New();<BR>
vtkMatrix4x4::Invert(&amp;xform, invert);<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>double</FONT></FONT><FONT size=2> world[4];<BR>
invert-&gt;MultiplyPoint(center, world);<BR>
vtkRendererCollection* rc = renWin-&gt;GetRenderers();<BR>
assert(rc &amp;&amp; rc-&gt;GetNumberOfItems() == 1);<BR>
vtkRenderer&amp; rndr = *rc-&gt;GetFirstRenderer();<BR>
rndr.SetWorldPoint(world);<BR>
rndr.WorldToDisplay();<BR>
rndr.GetDisplayPoint(display);<BR>
vtkCursor2D&amp; cursor = *callback-&gt;GetCursor2D();<BR>
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2>* size = renWin-&gt;GetSize();<BR>
cursor.SetModelBounds(1, size[0], 1, size[1], 0, 0);<BR>
cursor.SetFocalPoint(display);<BR></FONT>
&nbsp;<BR>
The problems is the Cursor2D so placed is slightly off from&nbsp;where the mouse&nbsp;is clicked,&nbsp;towards the center of the display.&nbsp; Is it caused by rounding error somewhere?&nbsp; Does anyone know of a fix?<BR>
&nbsp;<BR>
Thanks!<BR>
<BR>Xiaofeng Z<BR><BR><BR><BR>                                               <br /><hr />The New Busy is not the old busy. Search, chat and e-mail from your inbox. <a href='http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:WL:en-US:WM_HMP:032010_3' target='_new'>Get started.</a></body>
</html>