<div dir="ltr"><div><div>Hi,<br><br></div><div>try the following code snippet. Basically, create a callback class wherein<br>you decide how to update the reslice cursor widget from the image plane widget.<br></div><div>Add the callback to listen for the image plane widget's InteractionEvent.<br>
<br></div><div>regards,<br></div><div>Dean<br></div><div><br><br>class myCallback : public vtkCommand<br>{<br> public:<br> static myCallback *New() {<br> return new myCallback; }<br><br> void Execute( vtkObject* vtkNotUsed(caller), unsigned long vtkNotUsed(event),<br>
void * vtkNotUsed(callData) )<br> {<br></div> /** do something with ipwidget and rcwidget when the ipwidget fires a <br></div> an interaction event signal */<br><div><div> }<br><br> myCallback():ipwidget( 0 ), rcwidget( 0 ){}<br>
~myCallback(){ this->ipwidget= 0; this->rcwidget = 0; }<br> vtkImagePlaneWidget* ipwidget;<br> vtkResliceCursorWidget* rcwidget;<br>};<br><br><br></div><div>void myclass::some_setup_method()<br>{<br></div><div> vtkSmartPointer<myCallback> cbk = vtkSmartPointer<myCallback>::New();<br>
</div><div> cbk->ipwidget = this->ipwidget;<br> cbk->rcwidget = this->rcwidget;<br></div><div> this->ipwidget->AddObserver( vtkCommand::InteractionEvent, cbk );<br></div><div>}<br></div><div><br></div>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 20, 2013 at 10:15 PM, nil_debug <span dir="ltr"><<a href="mailto:ljp19890525@163.com" target="_blank">ljp19890525@163.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div style="MARGIN:10px">
<div><span style="text-indent:0px;letter-spacing:normal;font:14px/23px arial;text-transform:none;white-space:normal;display:inline!important;float:none;word-spacing:0px">Hello,</span>
<div style="text-indent:0px;letter-spacing:normal;font:14px/23px arial;text-transform:none;white-space:normal;word-spacing:0px">Is
anyone can help me? Now I have defined a vtkImagePlaneWidget and a
vtkResliceCursorWidget, I would like to when dragging the
vtkImagePlaneWidget the vtkResliceCursorWidget can move.In a
word I don't know how to a "AddObserver" for the vtkImagePlaneWidget
from the vtkResliceCursorWidget! I do know I should define a
"myCallBack",but How?</div>
<div style="text-indent:0px;letter-spacing:normal;font:14px/23px arial;text-transform:none;white-space:normal;word-spacing:0px">Will
be deeply grateful !</div></div>
<div> </div>
<hr style="WIDTH:210px;min-height:1px" align="left" color="#b5c4df" size="1"><span class="HOEnZb"><font color="#888888">
<div><span>nil_debug</span></div></font></span></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>