[IGSTK-Users] Get position tools
Eric L. B.
eric_lb at hotmail.com
Thu Aug 7 17:00:27 EDT 2008
Hi again!!!
I wrote about how to get the position of a tool with a Polaris Tracker.
I has received a response, with some code which define an observer, but i have a little problem with this part:
typedef itk::ReceptorMemberCommand < Self > LoadedObserverType;
What typedef is Self??????????
There is an error: Undeclared identifier
The whole code received is:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// define an observer in your main class
#include "igstkEvents.h"
typedef itk::ReceptorMemberCommand < Self > LoadedObserverType;LoadedObserverType::Pointer m_TrackerToolUpdateObserver;// set a callback function to itm_TrackerToolUpdateObserver = LoadedObserverType::New();m_TrackerToolUpdateObserver->SetCallbackFunction( this, &MyClass::TrackingCallback );// the callback function
void MyClass::TrackingCallback(const itk::EventObject & event ){ if ( igstk::TrackerToolTransformUpdateEvent().CheckEvent( &event ) ) { typedef igstk::TransformObserver ObserverType; ObserverType::Pointer transformObserver = ObserverType::New(); transformObserver->ObserveTransformEventsFrom( m_TrackerTool ); transformObserver->Clear(); m_TrackerTool->RequestComputeTransformTo( m_WorldReference ); // some reference e.g. igstk::AxesObject::Pointer m_WorldReference; if ( transformObserver->GotTransform() ) { igstk::Transform::VectorType translation; // get the translational component translation = transformObserver->GetTransform().GetTranslation(); // get the rotational component (quaternion) igstk::Transform::VersorType rotation; rotation= transformObserver->GetTransform().GetRotation(); } }}// and don't forget to add the observer to the tracker toolm_TrackerTool->AddObserver( igstk::TrackerToolTransformUpdateEvent(), m_TrackerToolUpdateObserver);///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I hope someone can help me please, or give me onother option to get coordinates of tools, please... :(
Thanks, i will be waiting for some response :D
_________________________________________________________________
P.D. Checa las nuevas fotos de mi Space
http://home.services.spaces.live.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20080807/29a7dcfa/attachment.html>
More information about the IGSTK-Users
mailing list