[vtkusers] scaling in planewigdet
amal /
foodofheart_looly at hotmail.com
Fri Jun 27 08:53:08 EDT 2008
hi for all:
i am trying to use the getcurserposition function into plane wigdet that is used to load dicom images in 3 views.the problem is the drawing is done far from the true point i've clicked on.i checked for the code it takes the real point but even though the excution is in another point.
the conclusion that i reached is that it takes the point from the image but excute it relative to the whole vtkformcontrol.
i need a scaling function that will help me to draw in the right position.
thanks in advance.
the code is
firstpoint = XYPlaneWidget.GetCurrentCursorPosition();
secondpoint = XYPlaneWidget.GetCurrentCursorPosition();
vtkPoints polylinepoints = new vtkPoints();
vtkPolyData polydata = new vtkPolyData();
vtkPolyDataMapper2D mapper = new vtkPolyDataMapper2D();
vtkActor2D actor = new vtkActor2D();
x1 = firstpoint[0];
y1 = firstpoint[1];
z1 = firstpoint[2];
x2 = secondpoint[0];
y2 = secondpoint[1];
z2 = secondpoint[2];
polylinepoints.InsertPoint(0, x1, y1, z1);
polylinepoints.InsertPoint(1, x2, y2 , z2);
vtkCellArray linexy = new vtkCellArray();
linexy.InsertNextCell(2);
linexy.InsertCellPoint(0);
linexy.InsertCellPoint(1);
polydata.SetPoints(polylinepoints);
polydata.SetLines(linexy);
mapper.SetInput(polydata);
mapper.SetScalarModeToUseCellData();
XYRenderer.RemoveActor(actor);
actor.SetMapper(mapper);
actor.GetProperty().SetColor(1, 0, 0);
actor.GetProperty().SetLineWidth(2);
XYRenderer.AddActor(actor);
XYRenderer.GetRenderWindow().Render();
اللهم قدرني علي من ظلمني.....لأجعل عفوى عنه
شكرا لك علي قدرتي عليه
_________________________________________________________________
Need to know now? Get instant answers with Windows Live Messenger.
http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_062008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080627/d27f3a4f/attachment.htm>
More information about the vtkusers
mailing list