[vtkusers] synchronous update between vtkImagePlaneWidget and vtkResliceCursorWidget

Mengda Wu wumengda at gmail.com
Sun Aug 4 02:06:00 EDT 2013


Hi Dean,

   I am trying your solution for this problem. But what exactly should I do
for
      /** do something with ipwidget and rcwidget when the ipwidget fires a
           an interaction event signal */?

   For vtkImagePlaneWidget, we have UpdatePlacement() as done in
Examples\GUI\Qt\FourPaneViewer\QtVTKRenderWindows.cxx. But we don't seem to
have a similar method for vtkResliceCursorWidget. Could you please give a
more detailed answer?

Thanks,
Mengda


On Mon, Jun 24, 2013 at 10:44 AM, Dean Inglis <inglis.dl at gmail.com> wrote:

> Hi,
>
> try the following code snippet.  Basically, create a callback class wherein
> you decide how to update the reslice cursor widget from the image plane
> widget.
> Add the callback to listen for the image plane widget's InteractionEvent.
>
> regards,
> Dean
>
>
> class myCallback : public vtkCommand
> {
>   public:
>     static myCallback *New() {
>       return new myCallback; }
>
>     void Execute( vtkObject* vtkNotUsed(caller), unsigned long
> vtkNotUsed(event),
>                   void * vtkNotUsed(callData) )
>     {
>       /** do something with ipwidget and rcwidget when the ipwidget fires
> a
>            an interaction event signal */
>     }
>
>  myCallback():ipwidget( 0 ), rcwidget( 0 ){}
>   ~myCallback(){ this->ipwidget= 0; this->rcwidget = 0; }
>   vtkImagePlaneWidget* ipwidget;
>   vtkResliceCursorWidget* rcwidget;
> };
>
>
> void myclass::some_setup_method()
> {
>   vtkSmartPointer<myCallback> cbk = vtkSmartPointer<myCallback>::New();
>   cbk->ipwidget = this->ipwidget;
>   cbk->rcwidget = this->rcwidget;
>   this->ipwidget->AddObserver( vtkCommand::InteractionEvent, cbk );
> }
>
>
>
> On Thu, Jun 20, 2013 at 10:15 PM, nil_debug <ljp19890525 at 163.com> wrote:
>
>> **
>> Hello,
>> 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?
>> Will be deeply grateful !
>>
>> ------------------------------
>> nil_debug
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130804/0c647d5d/attachment.htm>


More information about the vtkusers mailing list