[IGSTK-Users] Observers, events, and callback function
steve.berger at istb.unibe.ch
steve.berger at istb.unibe.ch
Wed Mar 12 12:24:59 EDT 2014
Dear IGSTK users,
I come to you following my difficulties to understand observers and events in IGSTK.
Basically, what I want to do, is simply print the position of a tracker every time its position is updated.
So I think I have to do something like:
myClassXY{
//in the constructor:
ObserverType myObs = ObserverType::New();
PolarisTrackerTool::Pointer myTrackerTool = PolarisTrackerTool::New();
myObs->SetCallbackFnct(this,&myCallbackMethod);
myTrackerTool->AddObserver(igstk::TrackerToolTransformUpdateEvent(), myObs);
//myCallbackMethod definition
void myCallbackMethod{
//print the position of myTrackerTool
}
}
But unfortunately, I am completely unsuccessful to implement it correctly. For example, I do not get how to create ObserverType.
More generally, I would like to be able to link any igstkEvent to any personal callback method.
Could anyone help me with this issue? I'm sure it is a basic thing, but I just can't figure out how to implement it...
Thanks a lot for your help,
Best,
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20140312/8243ff72/attachment.html>
More information about the IGSTK-Users
mailing list