[IGSTK-Users] Get position tools
sebastian ordas
sebastian.ordas at gmail.com
Thu Aug 7 18:24:10 EDT 2008
Hi Enric,
If you would like to try your tracker in a simpler way, I would
suggest checking a test example:
see e.g. MicronTrackerTrackerTest (or the corresponding test,
depending on the tracker system that you have)
in these tests, a command is defined, e.g. MicronTrackerTrackerTestCommand
and the way the tracker transformation is retrieved is as follows:
if (coordSystemAObserver->GotTransform())
{
transform = coordSystemAObserver->GetTransform();
if ( transform.IsValidNow() )
{
position = transform.GetTranslation();
std::cout << "Trackertool :"
<< trackerTool->GetTrackerToolIdentifier()
<< "\t\t Position = (" << position[0]
<< "," << position[1] << "," << position[2]
<< ")" << std::endl;
}
}
see the details in the test application
regards,
sebastian
On Thu, Aug 7, 2008 at 5:18 PM, sebastian ordas
<sebastian.ordas at gmail.com> wrote:
> Hi Enric,
>
> ReceptorMemberCommand is templated on the class where it is defined,
> which should be inherited from igstk::Object
>
> The "Self" typedef is defined in igstk::Object
>
> Have you derived your class from igstk::Object ?
>
> regards,
> sebastian
>
> On Thu, Aug 7, 2008 at 5:00 PM, Eric L. B. <eric_lb at hotmail.com> wrote:
>>
>> 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 it
>> m_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 tool
>> m_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
>>
>>
>>
>>
>>
>>
>> ________________________________
>> Si no te acuerdas quién quedó en traer los hielos, te urge usar Skydrive
>
More information about the IGSTK-Users
mailing list