<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000066">
Thanks! That worked. Here is the complete code if anyone wants to look
for it in the future:<br>
<br>
double normal[3];<br>
double origin[3];<br>
double p1[3];<br>
double p2[3];<br>
<br>
planeWidgetX->GetNormal(normal);<br>
<br>
planeWidgetX->GetOrigin(origin);<br>
origin[0]-=normal[0]; origin[1]-=normal[1]; origin[2]-=normal[2];<br>
planeWidgetX->SetOrigin(origin);<br>
<br>
planeWidgetX->GetPoint1(p1);<br>
p1[0]-=normal[0]; p1[1]-=normal[1]; p1[2]-=normal[2];<br>
planeWidgetX->SetPoint1(p1);<br>
<br>
planeWidgetX->GetPoint2(p2);<br>
p2[0]-=normal[0]; p2[1]-=normal[1]; p2[2]-=normal[2];<br>
planeWidgetX->SetPoint2(p2);<br>
<br>
planeWidgetX->UpdatePlacement();<br>
vtkWindow->Render();<br>
<br>
<br>
<br>
<br>
Dean Inglis wrote:
<blockquote cite="mid:6BADE577C1F744FFA042CF6973831E15@Hyoid"
type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta name="Generator" content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:#000066;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:#000066;}
p
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:#000066;}
pre
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:#000066;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:Arial;
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="Section1">
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;">It might be
that you are accessing and
modifying pointers<o:p></o:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;">directly:<o:p></o:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;"><o:p> </o:p></span></font></p>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR-CA"> double *normal;<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR-CA"> double *origin;<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR-CA"> double *p1;<o:p></o:p></span><u1:p></u1:p></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR-CA"> </span>double *p2;<o:p></o:p></font></pre>
<u1:p></u1:p>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> normal = planeWidgetX->GetNormal();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> origin = planeWidgetX->GetOrigin();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> origin[0]-=normal[0]; origin[1]-=normal[1]; origin[2]-=normal[2];<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> planeWidgetX->SetOrigin(origin);<u1:p></u1:p><o:p></o:p></span></font></pre>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;"><u1:p><o:p> </o:p></u1:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;">try using <o:p></o:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;">double
normal[3];<o:p></o:p></span></font></p>
<pre><font color="#000066" face="Courier New" size="2"><span
style="font-size: 10pt;">planeWidgetX->GetNormal(normal);<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre><font color="#000066" face="Courier New" size="2"><span
style="font-size: 10pt;"><o:p> </o:p></span></font></pre>
<pre><font color="#000066" face="Courier New" size="2"><span
style="font-size: 10pt;">etc. also, you do not need to call<o:p></o:p></span></font></pre>
<pre><font color="#000066" face="Courier New" size="2"><span
style="font-size: 10pt;">planeWidgetX->Modified();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre><font color="#000066" face="Courier New" size="2"><span
style="font-size: 10pt;">just<o:p></o:p></span></font></pre>
<pre><font color="#000066" face="Courier New" size="2"><span
style="font-size: 10pt;">planeWidgetX->UpdatePlacement();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre><font color="#000066" face="Courier New" size="2"><span
style="font-size: 10pt;"><o:p> </o:p></span></font></pre>
<pre><font color="#000066" face="Courier New" size="2"><span
style="font-size: 10pt;">Dean<o:p></o:p></span></font></pre>
<pre><font color="#000066" face="Courier New" size="2"><span
style="font-size: 10pt;"><o:p> </o:p></span></font></pre>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;"><u1:p><o:p> </o:p></u1:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;"><o:p> </o:p></span></font></p>
<div>
<div class="MsoNormal" style="margin-left: 36pt; text-align: center;"
align="center"><font color="black" face="Times New Roman" size="3"><span
style="font-size: 12pt; color: windowtext;" lang="EN-US">
<hr tabindex="-1" align="center" size="2" width="100%"></span></font></div>
<p class="MsoNormal" style="margin-left: 36pt;"><b><font color="black"
face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma; color: windowtext; font-weight: bold;"
lang="EN-US">From:</span></font></b><font color="black" face="Tahoma"
size="2"><span
style="font-size: 10pt; font-family: Tahoma; color: windowtext;"
lang="EN-US"> Greg Book [<a class="moz-txt-link-freetext" href="mailto:gbook@gbook.org">mailto:gbook@gbook.org</a>] <br>
<b><span style="font-weight: bold;">Sent:</span></b> August-10-09
5:03 PM<br>
<b><span style="font-weight: bold;">To:</span></b>
<a class="moz-txt-link-abbreviated" href="mailto:dean.inglis@camris.ca">dean.inglis@camris.ca</a><br>
<b><span style="font-weight: bold;">Cc:</span></b> <a class="moz-txt-link-abbreviated" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
<b><span style="font-weight: bold;">Subject:</span></b> Re:
[vtkusers] updating
plane placement in vtkImagePlaneWidget</span></font><font color="black"><span
style="color: windowtext;" lang="EN-US"><o:p></o:p></span></font></p>
</div>
<p class="MsoNormal" style="margin-left: 36pt;"><font color="#000066"
face="Times New Roman" size="3"><span style="font-size: 12pt;"><o:p> </o:p></span></font></p>
<p class="MsoNormal" style="margin-left: 36pt;"><font color="#000066"
face="Times New Roman" size="3"><span style="font-size: 12pt;">Unfortunately
adding that
line didn't work out. It updates the texture when I execute the code
below, and
it even updates the outline on the plane, but it doesn't update the
position of
the plane... so as I change the slice along the normal, the texture
appears to
change, but its location in 3d does not.<br>
-Greg<br>
<br>
<br>
Dean Inglis wrote: <o:p></o:p></span></font></p>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">Hi Greg,<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">sometimes this happens if you use a GUI element <u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">that embeds a vtkRenderWindow and that element does<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">not have focus. As soon as you place the mouse in<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">the renderwindow and click, the renderer updates.<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">try: <u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">planeWidgetX->GetInteractor()->Render();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">Dean<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><a
moz-do-not-send="true" href="http://www.camris.ca">www.camris.ca</a><u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">I'm using a vtkImagePlaneWidget to display some 3d data, and I need to<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">programmaticaly change the location of the current plane. I'm trying to<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">increment or decrement the location along the current plane normal. It<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">appears to work... but not completely. When I change points1,2,and the<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">origin, it updates the position of the bounding box of the plane, but<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">not the plane itself. If I try to move the plane with the middle mouse<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">button, it suddenly jumps to where it should be and then moves normally.<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">Here is the code to change the location of the plane along the current<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR-CA">normal:<u1:p></u1:p></span><o:p></o:p></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR-CA"><u1:p> </u1:p></span><o:p></o:p></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR-CA"> double *normal;<u1:p></u1:p></span><o:p></o:p></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR-CA"> double *origin;<u1:p></u1:p></span><o:p></o:p></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;" lang="FR-CA"> </span>double *p1;<u1:p></u1:p><o:p></o:p></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> double *p2;<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> normal = planeWidgetX->GetNormal();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> origin = planeWidgetX->GetOrigin();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> origin[0]-=normal[0]; origin[1]-=normal[1]; origin[2]-=normal[2];<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> planeWidgetX->SetOrigin(origin);<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> p1 = planeWidgetX->GetPoint1();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> p1[0]-=normal[0]; p1[1]-=normal[1]; p1[2]-=normal[2];<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> planeWidgetX->SetPoint1(p1);<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> p2 = planeWidgetX->GetPoint2();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> p2[0]-=normal[0]; p2[1]-=normal[1]; p2[2]-=normal[2];<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> planeWidgetX->SetPoint2(p2);<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> planeWidgetX->Modified();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> planeWidgetX->UpdatePlacement();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> //planeWidgetX->GetTexturePlaneProperty()->Render();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"> vtkWindow->Render();<u1:p></u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;"><u1:p> </u1:p><o:p></o:p></span></font></pre>
<pre style="margin-left: 36pt;"><font color="#000066"
face="Courier New" size="2"><span style="font-size: 10pt;">How do I update the plane once I've changed it's position?<u1:p></u1:p><o:p></o:p></span></font></pre>
<p class="MsoNormal" style="margin-left: 36pt;"><font color="#000066"
face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;"><u1:p> </u1:p></span></font><o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 36pt;"><font color="#000066"
face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;"><u1:p> </u1:p></span></font><o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 36pt;"><font color="#000066"
face="Times New Roman" size="3"><span style="font-size: 12pt;"><u1:p> </u1:p><o:p></o:p></span></font></p>
<p class="MsoNormal" style="margin-left: 36pt;"><font color="#000066"
face="Times New Roman" size="3"><span style="font-size: 12pt;"><o:p> </o:p></span></font></p>
</div>
</blockquote>
<br>
</body>
</html>