[vtkusers] QVTKWidget with interactorStyleImage does not work

lindeval at dmat.ufrr.br lindeval at dmat.ufrr.br
Fri Feb 18 20:43:19 EST 2011


in body of constructor(in my code):

fant->m_connections = vtkEventQtSlotConnect::New();

fant->m_connections->Connect(ui->qvtkWidgetTrans->GetRenderWindow()->GetInteractor(),
                                 vtkCommand::LeftButtonPressEvent, this,
                                 SLOT(slotEventMousePressed(vtkObject*,unsigned long, void*, void*,vtkCommand*)), 0, 1.0);

------------------------------------------------------------

void FantWindow::slotEventMousePressed(vtkObject* caller, unsigned long, void* , void* data, vtkCommand* command)
{

    vtkRenderWindowInteractor  *iren = reinterpret_cast<vtkRenderWindowInteractor*>(caller);

    iren->GetEventPosition(this->pos);
    
    //ui->labNfatTrPos->setText(tr("Pos=(%1,%2)").arg(this->pos[0]).arg(this->pos[1]));
    //ui->labNfatTrPos->setAlignment(Qt::AlignVCenter | Qt::AlignRight);

    cout << "Xpos = " << pos[0] << " " << "Ypos = " << pos[1] << endl;

}

This solves the question of the position. In this window I have a slice, but I can't get the color 
corresponding to the position where the mouse was clicked. Any suggestions?



----- Mensagem original -----
De: "Jothy" <jothybasu at gmail.com>
Para: lindeval at dmat.ufrr.br
Cc: "VTK Mailing List" <vtkusers at vtk.org>
Enviadas: Quinta-feira, 17 de Fevereiro de 2011 8:42:23 (GMT-0300) Auto-Detected
Assunto: Re: [vtkusers] QVTKWidget with interactorStyleImage does not work

Could oyu please send me this code

fant->mcb

Thank you

Jothy

On Wed, Feb 16, 2011 at 8:42 PM,  <lindeval at dmat.ufrr.br> wrote:
> Hi!!
>
> See in my code below how to use vtkInteractorStyleImage with QVTKWidget.
>
>
>    fant->sliceTransversalRen->AddActor(fant->sliceTransversalActor);
>    fant->sliceTransversalRen->SetBackground(1.0,1.0,1.0);
>
>    vtkInteractorStyleImage *style = vtkInteractorStyleImage::New();
>    ui->qvtkWidgetTrans->GetRenderWindow()->AddRenderer(fant->sliceTransversalRen);
>    ui->qvtkWidgetTrans->GetRenderWindow()->Render();
>    //ui->qvtkWidgetTrans->GetRenderWindow()->GetInteractor()->AddObserver(vtkCommand::LeftButtonPressEvent,fant->mcb,1.0);
>    ui->qvtkWidgetTrans->GetRenderWindow()->GetInteractor()->SetInteractorStyle(style);
>
>
> ----- Mensagem original -----
> De: "Jothy" <jothybasu at gmail.com>
> Para: "VTK Mailing List" <vtkusers at vtk.org>
> Enviadas: Quarta-feira, 16 de Fevereiro de 2011 8:19:04 (GMT-0300) Auto-Detected
> Assunto: [vtkusers] QVTKWidget with interactorStyleImage does not work
>
> Hi all,
>
> I am trying to set the interactor style to image ina QVTKWidget.I am
> setting it by calling the interactor by
> QVTKWidget->GetInteractor()->SetInteractorStyle().
>
> But it doesn't work. The image doesn't rotate as expected for a 2D
> image interactor, but the W/L and W/W don't change on mouse move!
>
> Here is the bit of that code
>
> this->axialRenderer ->AddActor(slicer.axialSlice);
>  this->ui->AxialWidget->GetInteractor()->SetInteractorStyle(this->imageInteractorStyle);
>  this->ui->AxialWidget->GetRenderWindow()->AddRenderer(this->axialRenderer);
>  this->ui->AxialWidget->GetRenderWindow()->Render();
> //this->ui->AxialWidget->show();
>
>
> Thanks
>
> Jothy
> _______________________________________________
> 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
>
>




More information about the vtkusers mailing list