<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
have you tried to set:<BR>
&nbsp;<BR><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
reslice-&gt;SetOutputDimensionality(2);<BR>
&nbsp;<BR>
This will&nbsp;cause the z-component of the resliced&nbsp;image position to zero.</FONT></FONT><BR><BR>Xiaofeng Zhao<BR><BR><BR><BR>&nbsp;<BR>&gt; Date: Mon, 28 Jun 2010 15:46:48 -0400<BR>&gt; Subject: Re: [vtkusers] 3D-position of vtkImageReslice<BR>&gt; From: tutmann@gmail.com<BR>&gt; To: xf10036@hotmail.com<BR>&gt; CC: vtkusers@vtk.org<BR>&gt; <BR>&gt; Hi Xiaofeng,<BR>&gt; <BR>&gt; it's me again with the 3D-Position issue in a vtkImageReslice.<BR>&gt; It seems to work great for relative positions like interactions for<BR>&gt; translations and stuff.<BR>&gt; But when I use it to paint directly into an image, I find, that the<BR>&gt; reported position is off in the direction of the viewer. The offset<BR>&gt; depends on the scale of the transform.<BR>&gt; So for my scale-settings a hack like this works somehow:<BR>&gt; <BR>&gt; point[2] = 0.38; // Hack<BR>&gt; <BR>&gt; But this cannot possibly the solution. Do you have any idea how to<BR>&gt; correct for this?<BR>&gt; <BR>&gt; Thank you,<BR>&gt; <BR>&gt; Henning<BR>&gt; <BR>&gt; 2010/3/25 Xiaofeng Z &lt;xf10036@hotmail.com&gt;:<BR>&gt; &gt; It took me a day to figure out:<BR>&gt; &gt;<BR>&gt; &gt; // first convert from display to world in the resliced coordinate<BR>&gt; &gt; vtkRenderer&amp; rndr =<BR>&gt; &gt; *interactor-&gt;GetRenderWindow()-&gt;GetRenderers()-&gt;GetFirstRenderer();<BR>&gt; &gt; rndr.SetDisplayPoint(currPos[0], currPos[1], 0);<BR>&gt; &gt; rndr.DisplayToWorld();<BR>&gt; &gt; double point[4];<BR>&gt; &gt; rndr.GetWorldPoint(point);<BR>&gt; &gt; // the value in the third component is fake, why???<BR>&gt; &gt; point[2] = 0.0;<BR>&gt; &gt;<BR>&gt; &gt; // next, convert back to the original vtkImageData coordinate system<BR>&gt; &gt; vtkImageReslice* reslice = ImageReslice;<BR>&gt; &gt; reslice-&gt;GetOutput()-&gt;UpdateInformation();<BR>&gt; &gt; vtkImageData&amp; slice = *reslice-&gt;GetOutput();<BR>&gt; &gt; vtkMatrix4x4 *matrix = reslice-&gt;GetResliceAxes();<BR>&gt; &gt; double center[4];<BR>&gt; &gt; matrix-&gt;MultiplyPoint(point, center);<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt; Hope this works!<BR>&gt; &gt;<BR>&gt; &gt; Xiaofeng Zhao<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt;&gt; Date: Wed, 24 Mar 2010 16:09:57 -0400<BR>&gt; &gt;&gt; From: tutmann@gmail.com<BR>&gt; &gt;&gt; To: vtkusers@vtk.org<BR>&gt; &gt;&gt; Subject: [vtkusers] 3D-position of vtkImageReslice<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Hello,<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; I'm building an application based on ImageProcessing/Cxx/ImageSlicing.cxx.<BR>&gt; &gt;&gt; Currently I'm on my way of writing my own interactor style in order to<BR>&gt; &gt;&gt; have more flexible interaction freedom.<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Rotation, windowing and zoom works fine - but now I want to move my<BR>&gt; &gt;&gt; Volume by dragging the mouse. The movement should be in sync with the<BR>&gt; &gt;&gt; mouse motion.<BR>&gt; &gt;&gt; Therefore I'd like to find out the real 3D-Position (in the volume) of<BR>&gt; &gt;&gt; the EventPosition and the LastEventPosition.<BR>&gt; &gt;&gt; But I don't know how to do that. The Display chain is like:<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; vtkImageData -&gt; vtkImageReslice -&gt; vtkImageMapToColors -&gt;<BR>&gt; &gt;&gt; vtkImageActor -&gt; vtkRenderer -&gt; vtkViewPort<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; How can I find out the amount of translation that has to be applied to<BR>&gt; &gt;&gt; the ResliceAxes-Matrix? (I already have the right direction - am just<BR>&gt; &gt;&gt; missing the scaling value of the translation).<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Thank you for your help!<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Henning<BR>&gt; &gt;&gt; _______________________________________________<BR>&gt; &gt;&gt; Powered by www.kitware.com<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Visit other Kitware open-source projects at<BR>&gt; &gt;&gt; http://www.kitware.com/opensource/opensource.html<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Please keep messages on-topic and check the VTK FAQ at:<BR>&gt; &gt;&gt; http://www.vtk.org/Wiki/VTK_FAQ<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Follow this link to subscribe/unsubscribe:<BR>&gt; &gt;&gt; http://www.vtk.org/mailman/listinfo/vtkusers<BR>&gt; &gt;<BR>&gt; &gt; ________________________________<BR>&gt; &gt; Hotmail is redefining busy with tools for the New Busy. Get more from your<BR>&gt; &gt; inbox. Sign up now.<BR>                                               <br /><hr />Hotmail is redefining busy with tools for the New Busy. Get more from your inbox. <a href='http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2' target='_new'>See how.</a></body>
</html>