[IGSTK-Users] igstk::QView and registration applications
Luis Ibanez
luis.ibanez at kitware.com
Mon May 14 08:16:06 EDT 2007
Hi Torleif,
The behavior that you observe in the igstkView2D (that is
actually defined in the igstkView class), it is not yet
defined in the igstkQView class.
To be more precise:
1) For the Observer of the TransformModifiedEvent to work,
the View class must invoke a TransformModifiedEvent from
the interaction that listens to the mouse click on the GUI.
In the case of the View class this is done in the method:
View::handle()
in lines 835-857.
2) The equivalent code in the QView is performed at the
level of the vtkQWidget class in:
VTK/GUISupport/Qt/QVTKWidget.cxx
in line 601: method QVTKWidget::mouseReleaseEvent()
The management of the left mouse release event is made in
lines : 628-630:
case Qt::LeftButton:
iren->InvokeEvent(vtkCommand::LeftButtonReleaseEvent, e);
break;
3) One way of solving this issue is to add to the QView class
an overloaded implementation of the method:
mouseReleaseEvent(QMouseEvent* e)
and insert in the case statement for LeftButton the code
that uses a Picker for sending the TransformModifiedEvent
out to any potential observers. We must also add to the
QView the vtkWorldPointPicker as a member variable.
Please note that all these changes will be regrouped when
the View class is refactored in order to unify the FLTK
and the Qt implementations.
Regards,
Luis
-----------------------
Torleif Sandnes wrote:
> Hi.
>
> I want to be able to do patient registration, and will ned a way to get
> image coordinates from user mouseclicks in my igstk::QView2D.
> If I Understand Correctly, the Needlebiopsy example does this in
> DrawPickedPoint(const itk::Event& event), so I tried to do something
> like this:
>
> 1. In my class definition:
> typedef itk::ReceptorMemberCommand<Self> ObserverType;
> ObserverType::Pointer mTransformObserver;
>
> 2. In my class constructor:
> mTransformObserver = ObserverType::New();
> mTransformObserver->SetCallbackFunction(this,
> &MyClass::handleTransformEvent);
>
> 3. After loading a Dicom image and showing it in an igstk::QView2D:
> mAxialViewWidget->AddObserver(igstk::TransformModifiedEvent(),
> mTransformObserver);
>
> 4. Finally, I created the function MyClass:handleTransformEvent():
> void MyClass::handleTransformEvent(const itk::EventObject& event)
> {
> cout << "Transform event received: ";
> }
>
> Unfortunately, I fail to see any output from this function.
>
> Am I entirely off the rails with this approach?
> Is there a(n) (IGSTK) way to accomplish this?
>
> Regards,
> Torleif Sandnes
> Sintef Health Research
> _______________________________________________
> IGSTK-Users mailing list
> IGSTK-Users at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users
>
More information about the IGSTK-Users
mailing list