[vtkusers] QVTKWidget with interactorStyleImage does not work

Karthik Krishnan karthik.krishnan at kitware.com
Thu Feb 17 05:59:01 EST 2011


The W/L LUT mapping is not and was never handled in QVTKWidget or in
vtkInteractorStyleImage.

vtkInteractorStyleImage simply provides the events. Its up to you to respond
to the WindowLevelEvent and hook your own vtkImageMapToColors to do the LUT
mapping.

See how the class vtkImageViewer2 does it.

On Thu, Feb 17, 2011 at 3:46 PM, Jothy <jothybasu at gmail.com> wrote:

> Thanks for the help
>
> But it still doesn't work, hese is my code
>
> this->axialRenderer ->AddActor(slicer.axialSlice);
>  vtkInteractorStyleImage *style = vtkInteractorStyleImage::New();
>
>  this->ui->AxialWidget->GetRenderWindow()->AddRenderer(this->axialRenderer);
>  this->ui->AxialWidget->GetRenderWindow()->Render();
>  this->ui->AxialWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(style);
>
> Is it necessary to add observer, if I wnat to use the default
> functionality of the interactor?
>
> I think it has something with the classing, QtWidgets has this problem with
> vtk.
>
> Thanks
>
> 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
> >
> >
> _______________________________________________
> 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/20110217/fa597c97/attachment.htm>


More information about the vtkusers mailing list