<!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> </DIV>
<DIV><FONT face=Arial size=2>When rotating a vtkImagePlaneWidget plane around 2
axes (not just one, but ex: X & 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 of the two axes (when the image is very distorted) 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> </DIV>
<DIV><FONT face=Arial size=2>I am using the IPW->SetPoint1(), SetPoint2(),
and SetOrigin() methods, after computing the 3 new points, after the
rotation.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </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> </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> </DIV><FONT face=Arial size=2>
<DIV><BR>void CVtkView::UpdateAngles(float A1, float A2)<BR>{<BR> float
o[3]; vImagePlaneWidget[i4]->GetOrigin(o);<BR> float p1[3];
vImagePlaneWidget[i4]->GetPoint1(p1);<BR> float p2[3];
vImagePlaneWidget[i4]->GetPoint2(p2);</DIV>
<DIV> </DIV>
<DIV>...</DIV>
<DIV> </DIV>
<DIV> float o_[3], p1_[3], p2_[3]; //coordinates after
1st rotation<BR> float o__[3], p1__[3], p2__[3];
//coordinates after 2nd rotation<BR></DIV>
<DIV>...</DIV>
<DIV><BR> float *RP=m_vRefPointPos; //The point which
defines the 2 axes, around which I will rotate the IPW<BR> float
R1[3];<BR> R1[i1]=p1[i1];<BR> R1[i2]=RP[i2];<BR> R1[i3]=RP[i3];
//z<BR> float
R2[3];<BR> R2[i1]=p2[i1];<BR> R2[i2]=RP[i2];<BR> R2[i3]=RP[i3];
//z</DIV>
<DIV> </DIV>
<DIV> //First rotate around i1 (say x: => y=Ry
<BR> o_[i1]=o[i1]; <BR> o_[i2]=(o[i2]-R1[i2])*cos(A1)-(o[i3]-R1[i3])*sin(A1)+R1[i2];<BR> o_[i3]=(o[i2]-R1[i2])*sin(A1)+(o[i3]-R1[i3])*cos(A1)+R1[i3];</DIV>
<DIV> </DIV>
<DIV> p1_[i1]=p1[i1]; <BR> p1_[i2]=(p1[i2]-R1[i2])*cos(A1)-(p1[i3]-R1[i3])*sin(A1)+R1[i2];<BR> p1_[i3]=(p1[i2]-R1[i2])*sin(A1)+(p1[i3]-R1[i3])*cos(A1)+R1[i3];</DIV>
<DIV> </DIV>
<DIV> p2_[i1]=p2[i1]; <BR> p2_[i2]=(p2[i2]-R2[i2])*cos(A1)-(p2[i3]-R2[i3])*sin(A1)+R2[i2];<BR> p2_[i3]=(p2[i2]-R2[i2])*sin(A1)+(p2[i3]-R2[i3])*cos(A1)+R2[i3];</DIV>
<DIV> </DIV>
<DIV> //Second rotate around i2 (y) => x=Rx</DIV>
<DIV> </DIV>
<DIV> float
R1_[3];<BR> R1_[i1]=RP[i1];<BR> R1_[i2]=p1_[i2];<BR> R1_[i3]=p1_[i3];
//z<BR> float R2_[3];<BR> R2_[i1]=RP[i1];<BR> R2_[i2]=p2_[i2];
//=o_[i2]<BR> R2_[i3]=p2_[i3]; //=o_[i3]</DIV>
<DIV> </DIV>
<DIV> o__[i1]=(o_[i1]-R2_[i1])*cos(A2)-(o_[i3]-R2_[i3])*sin(A2)+R2_[i1];<BR> o__[i2]=o_[i2];<BR> o__[i3]=(o_[i1]-R2_[i1])*sin(A2)+(o_[i3]-R2_[i3])*cos(A2)+R2_[i3];</DIV>
<DIV> </DIV>
<DIV> p1__[i1]=(p1_[i1]-R1_[i1])*cos(A2)-(p1_[i3]-R1_[i3])*sin(A2)+R1_[i1];<BR> p1__[i2]=p1_[i2];<BR> p1__[i3]=(p1_[i1]-R1_[i1])*sin(A2)+(p1_[i3]-R1_[i3])*cos(A2)+R1_[i3];</DIV>
<DIV> </DIV>
<DIV> p2__[i1]=(p2_[i1]-R2_[i1])*cos(A2)+(p2_[i3]-R2_[i3])*sin(A2)+R2_[i1];<BR> p2__[i2]=p2_[i2];<BR> p2__[i3]=(p2_[i1]-R2_[i1])*sin(A2)+(p2_[i3]-R2_[i3])*cos(A2)+R2_[i3];</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> vImagePlaneWidget[3]->SetOrigin(o__);<BR> vImagePlaneWidget[3]->SetPoint1(p1__);<BR> vImagePlaneWidget[3]->SetPoint2(p2__);<BR> vImagePlaneWidget[3]->RestrictPlaneToVolumeOff();
//I thought this would solve the problem, but did not
....<BR> vImagePlaneWidget[3]->UpdatePlacement();<BR></DIV>
<DIV>...</DIV>
<DIV>}</FONT></DIV></BODY></HTML>