[vtk-developers] capture mouse event

toulgen toulgen at gmail.com
Thu Jun 25 11:20:15 EDT 2009


Hi,

 

I use this pipeline to render volume.

 

My question is: how I can capture a mouse event? I want to zoom in/zoom out
my volume with mouse wheel scrolls.

 

Thx,

ToulGen

 

My code :

========

    this->m_vtkpRendererVolume = vtkRenderer::New();

 

    this->m_vtkpRenWin = vtkRenderWindow::New();

            this->m_vtkpRenWin->DoubleBufferOn();

            this->m_vtkpRenWin->SetDesiredUpdateRate(1);

            this->m_vtkpRenWin->SetSize(this->m_Width, this->m_Height);

            this->m_vtkpRenWin->AddRenderer( this->m_vtkpRendererVolume );

 

            this->m_vtkpRenWin ->SetParentId(hWnd); 

            

    // Make interactive

    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();

            iren->SetStillUpdateRate(1); 

            iren->SetDesiredUpdateRate(10); 

            iren->SetRenderWindow(this->m_vtkpRenWin);

 

    // Standard transfer functions

    ...

 

    vtkVolumeRayCastCompositeFunction *compositeFunction =
vtkVolumeRayCastCompositeFunction::New();

            compositeFunction->SetCompositeMethodToInterpolateFirst();

 

    vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();

    volumeMapper->SetVolumeRayCastFunction(compositeFunction);

            volumeMapper->SetInput(this->m_vtkpVolume->GetOutput());

 

    m_vtkpVolumeForDisplay = vtkVolume::New();

    m_vtkpVolumeForDisplay->SetMapper(volumeMapper);

    m_vtkpVolumeForDisplay->SetProperty(volumeProperty);

 

            this->m_vtkpRendererVolume->AddVolume(m_vtkpVolumeForDisplay);

            

    this->m_vtkpRenWin->Render();

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20090625/09b63cd4/attachment.html>


More information about the vtk-developers mailing list