[vtkusers] Multiple renderes and interactor callback

David Gobbi david.gobbi at gmail.com
Tue Aug 26 10:12:35 EDT 2014


Hi Ali,

MPR synchronization can be tricky, and I don't know anyone who has
done it successfully by only sharing cameras between the renderers.
You might have better luck if you have independent cameras, and copy
specific camera parameters (e.g. focal point, direction, etc) between
the cameras.

 - David

On Tue, Aug 26, 2014 at 4:15 AM, sfaisalali91 <sfaisal.ali91 at gmail.com> wrote:
> hey guys,
>
>  I am trying to synchronize MPR view with Volume rendering view and to
> achieve this i am using multiple viewports (3 to display Mpr and 1 to
> display volume) and an interactor for overall interaction making use of
> vtkInteractorStyleSwitch and vtkInteractorStyleImage.
>
> Using a callback function and MouseMoveEvent i am able to achieve the
> desired i.e, volume renders independently (only at the first interaction)
> and as i move the 3d cursor to slice through different orientations the
> volume rotates accordingly, but i am facing a problem interacting and
> resetting the interactor of volume renderer after interacting with the MPR
> views as the camera of volume renderer is synchronized with other views. i
> tried to reset the camera, assign another camera and also tried calling
> another function to reinitialize interactor of volume renderer but
> everything in vain.
>
> Here is a snippet of my call back function.
>
> vtkRenderer *pokedRenderer = iren->FindPokedRenderer(currPos[0],
> currPos[1]); //mouse movement
>          if (event == vtkCommand::MouseMoveEvent)
>                 {
>                 if (pokedRenderer == renn[0])
>                         {
>                         iren->SetInteractorStyle(ImageIren);
>                         ImageRenderer->SetActiveCamera(renn[2]->GetActiveCamera());
>                         }
>                         else if (pokedRenderer == renn[1])
>                         {
>                         iren->SetInteractorStyle(ImageIren);
>                         ImageRenderer->SetActiveCamera(renn[0]->GetActiveCamera());
>                         }
>                         else if (pokedRenderer == renn[2])
>                         {
>                         iren->SetInteractorStyle(ImageIren);
>                         ImageRenderer->SetActiveCamera(renn[1]->GetActiveCamera());
>                         }
>                         else if (pokedRenderer == ImageRenderer)  //Volume Renderer
>                         {
>                         ImageIren->Delete();
>                         iren->RemoveObserver(MouseMoveEvent);
>                         iren->SetInteractorStyle(VolumeIren);
>                         iren->ReInitialize();
>                         VolumeIren->Rotate();
>                         ImageRenderer->ResetCamera();
>                        //ImageRenderer->ResetCameraClippingRange();
>                         iren->Render();
>                         }
>             }
>
>          };
>
> I highly appreciate your help.
>
> Thanks & Regards
> Ali


More information about the vtkusers mailing list