[vtkusers] updating plane placement in vtkImagePlaneWidget
Dean Inglis
dean.inglis at camris.ca
Mon Aug 10 17:21:59 EDT 2009
It might be that you are accessing and modifying pointers
directly:
double *normal;
double *origin;
double *p1;
double *p2;
normal = planeWidgetX->GetNormal();
origin = planeWidgetX->GetOrigin();
origin[0]-=normal[0]; origin[1]-=normal[1]; origin[2]-=normal[2];
planeWidgetX->SetOrigin(origin);
try using
double normal[3];
planeWidgetX->GetNormal(normal);
etc. also, you do not need to call
planeWidgetX->Modified();
just
planeWidgetX->UpdatePlacement();
Dean
_____
From: Greg Book [mailto:gbook at gbook.org]
Sent: August-10-09 5:03 PM
To: dean.inglis at camris.ca
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] updating plane placement in vtkImagePlaneWidget
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.
-Greg
Dean Inglis wrote:
Hi Greg,
sometimes this happens if you use a GUI element
that embeds a vtkRenderWindow and that element does
not have focus. As soon as you place the mouse in
the renderwindow and click, the renderer updates.
try:
planeWidgetX->GetInteractor()->Render();
Dean
www.camris.ca
I'm using a vtkImagePlaneWidget to display some 3d data, and I need to
programmaticaly change the location of the current plane. I'm trying to
increment or decrement the location along the current plane normal. It
appears to work... but not completely. When I change points1,2,and the
origin, it updates the position of the bounding box of the plane, but
not the plane itself. If I try to move the plane with the middle mouse
button, it suddenly jumps to where it should be and then moves normally.
Here is the code to change the location of the plane along the current
normal:
double *normal;
double *origin;
double *p1;
double *p2;
normal = planeWidgetX->GetNormal();
origin = planeWidgetX->GetOrigin();
origin[0]-=normal[0]; origin[1]-=normal[1]; origin[2]-=normal[2];
planeWidgetX->SetOrigin(origin);
p1 = planeWidgetX->GetPoint1();
p1[0]-=normal[0]; p1[1]-=normal[1]; p1[2]-=normal[2];
planeWidgetX->SetPoint1(p1);
p2 = planeWidgetX->GetPoint2();
p2[0]-=normal[0]; p2[1]-=normal[1]; p2[2]-=normal[2];
planeWidgetX->SetPoint2(p2);
planeWidgetX->Modified();
planeWidgetX->UpdatePlacement();
//planeWidgetX->GetTexturePlaneProperty()->Render();
vtkWindow->Render();
How do I update the plane once I've changed it's position?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090810/99245b1e/attachment.htm>
More information about the vtkusers
mailing list