<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#cae2b4>
<DIV><FONT face=Arial size=2>Hello!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>When rotating a vtkImagePlaneWidget plane around 2 
axes (not just one, but ex: X &amp; Y), the image on the plane is getting 
distorted, translated to the left or to the right, not being in concordance with 
the content of the volume (or with an orthogonal IPW reslice for 
example).</FONT></DIV>
<DIV><FONT face=Arial size=2>Furthermore, after rotating to more then 60-70 
degrees on both&nbsp;of the two axes (when the image is very distorted)&nbsp;I 
am receiving "Undhandled Exception"s in vtkImagePlaneWidget.cxx line 
</FONT><FONT face=Arial size=2>1465.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I am using the IPW-&gt;SetPoint1(), SetPoint2(), 
and SetOrigin() methods, after computing the 3 new points, after the 
rotation.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>How can I solve this? Is this a bug in vtk or is 
there something that I'm doing wrong?</FONT></DIV>
<DIV><FONT face=Arial size=2>See my code below:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV><FONT face=Arial size=2>Istvan</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV><FONT face=Arial size=2>
<DIV><BR>void CVtkView::UpdateAngles(float A1, float A2)<BR>{<BR>&nbsp;float 
o[3]; vImagePlaneWidget[i4]-&gt;GetOrigin(o);<BR>&nbsp;float p1[3]; 
vImagePlaneWidget[i4]-&gt;GetPoint1(p1);<BR>&nbsp;float p2[3]; 
vImagePlaneWidget[i4]-&gt;GetPoint2(p2);</DIV>
<DIV>&nbsp;</DIV>
<DIV>...</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;float o_[3], p1_[3], p2_[3];&nbsp;&nbsp;&nbsp; //coordinates after 
1st rotation<BR>&nbsp;float o__[3], p1__[3], p2__[3];&nbsp;&nbsp;&nbsp; 
//coordinates after 2nd rotation<BR></DIV>
<DIV>...</DIV>
<DIV><BR>&nbsp;float *RP=m_vRefPointPos;&nbsp;&nbsp;&nbsp; //The point which 
defines&nbsp;the 2 axes, around which I will rotate the IPW<BR>&nbsp;float 
R1[3];<BR>&nbsp;R1[i1]=p1[i1];<BR>&nbsp;R1[i2]=RP[i2];<BR>&nbsp;R1[i3]=RP[i3]; 
//z<BR>&nbsp;float 
R2[3];<BR>&nbsp;R2[i1]=p2[i1];<BR>&nbsp;R2[i2]=RP[i2];<BR>&nbsp;R2[i3]=RP[i3]; 
//z</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;//First rotate around i1 (say x: =&gt; y=Ry 
<BR>&nbsp;o_[i1]=o[i1];&nbsp;<BR>&nbsp;o_[i2]=(o[i2]-R1[i2])*cos(A1)-(o[i3]-R1[i3])*sin(A1)+R1[i2];<BR>&nbsp;o_[i3]=(o[i2]-R1[i2])*sin(A1)+(o[i3]-R1[i3])*cos(A1)+R1[i3];</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;p1_[i1]=p1[i1];&nbsp;<BR>&nbsp;p1_[i2]=(p1[i2]-R1[i2])*cos(A1)-(p1[i3]-R1[i3])*sin(A1)+R1[i2];<BR>&nbsp;p1_[i3]=(p1[i2]-R1[i2])*sin(A1)+(p1[i3]-R1[i3])*cos(A1)+R1[i3];</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;p2_[i1]=p2[i1];&nbsp;<BR>&nbsp;p2_[i2]=(p2[i2]-R2[i2])*cos(A1)-(p2[i3]-R2[i3])*sin(A1)+R2[i2];<BR>&nbsp;p2_[i3]=(p2[i2]-R2[i2])*sin(A1)+(p2[i3]-R2[i3])*cos(A1)+R2[i3];</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;//Second rotate around i2 (y) =&gt; x=Rx</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;float 
R1_[3];<BR>&nbsp;R1_[i1]=RP[i1];<BR>&nbsp;R1_[i2]=p1_[i2];<BR>&nbsp;R1_[i3]=p1_[i3]; 
//z<BR>&nbsp;float R2_[3];<BR>&nbsp;R2_[i1]=RP[i1];<BR>&nbsp;R2_[i2]=p2_[i2]; 
//=o_[i2]<BR>&nbsp;R2_[i3]=p2_[i3]; //=o_[i3]</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;o__[i1]=(o_[i1]-R2_[i1])*cos(A2)-(o_[i3]-R2_[i3])*sin(A2)+R2_[i1];<BR>&nbsp;o__[i2]=o_[i2];<BR>&nbsp;o__[i3]=(o_[i1]-R2_[i1])*sin(A2)+(o_[i3]-R2_[i3])*cos(A2)+R2_[i3];</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;p1__[i1]=(p1_[i1]-R1_[i1])*cos(A2)-(p1_[i3]-R1_[i3])*sin(A2)+R1_[i1];<BR>&nbsp;p1__[i2]=p1_[i2];<BR>&nbsp;p1__[i3]=(p1_[i1]-R1_[i1])*sin(A2)+(p1_[i3]-R1_[i3])*cos(A2)+R1_[i3];</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;p2__[i1]=(p2_[i1]-R2_[i1])*cos(A2)+(p2_[i3]-R2_[i3])*sin(A2)+R2_[i1];<BR>&nbsp;p2__[i2]=p2_[i2];<BR>&nbsp;p2__[i3]=(p2_[i1]-R2_[i1])*sin(A2)+(p2_[i3]-R2_[i3])*cos(A2)+R2_[i3];</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;vImagePlaneWidget[3]-&gt;SetOrigin(o__);<BR>&nbsp;vImagePlaneWidget[3]-&gt;SetPoint1(p1__);<BR>&nbsp;vImagePlaneWidget[3]-&gt;SetPoint2(p2__);<BR>&nbsp;vImagePlaneWidget[3]-&gt;RestrictPlaneToVolumeOff(); 
&nbsp;&nbsp;&nbsp; //I thought this would solve the problem, but did not 
....<BR>&nbsp;vImagePlaneWidget[3]-&gt;UpdatePlacement();<BR></DIV>
<DIV>...</DIV>
<DIV>}</FONT></DIV></BODY></HTML>