[IGSTK-Users] Using Mouse Tracker in Navigator
chamara jayalath
jaya.chamara at gmail.com
Mon Jun 14 05:27:38 EDT 2010
HI all,
I tried to use the mouse tracker in the navigator exp. in plz of other IGSTK
trackers. As there is not reference tool I changed the initializing to make
the tracker the world reference and then attached the tracker tool to the
tracker.
tracker->RequestSetTransformAndParent(identity, m_WorldReference); is what
I did in the Tracker Initializing.
Then when accepting the tracker fiducials, I did the following. But the
transforms are not achieved by the tracker tool's transform observer. I
tried various things but nothing was succesful. So if anyone could help me
as quick as possible that would be very helpful. Also I should ask here
whether we should attach the tracker to the GUI to use it as a mouse
tracker, I mean to get the coordinates. The code snippets is given below.
void
Navigator::AcceptTrackerFiducialProcessing()
{
igstkLogMacro2( m_Logger, DEBUG, "igstk::Navigator::"
"AcceptTrackerFiducialProcessing called...\n");
typedef igstk::TransformObserver ObserverType;
ObserverType::Pointer transformObserver = ObserverType::New();
transformObserver->ObserveTransformEventsFrom( trackerTool );
typedef ::itk::Vector<double, 3> VectorType;
typedef ::itk::Versor<double> VersorType;
TransformType transform;
VectorType position;
transformObserver->Clear();
trackerTool->RequestComputeTransformTo( m_WorldReference );
int n = m_FiducialsPointList->value();
int m = m_FiducialsPointList->size();
if (transformObserver->GotTransform())
{
transform=transformObserver->GetTransform();
position = transform.GetTranslation();
std::cout << "Trackertool :"
<< trackerTool->GetTrackerToolIdentifier()
<< "\t\t Position = (" << position[0]
<< "," << position[1] << "," << position[2]
<< ")" << std::endl;
m_LandmarksContainer[n]= TransformToPoint( transform );
}
m_AcceptedLandmarksContainer[n] = true;
m_AxialFiducialRepresentationVector[n]->SetColor( 0.0, 1.0, 0.0 );
m_SagittalFiducialRepresentationVector[n]->SetColor( 0.0, 1.0, 0.0 );
m_CoronalFiducialRepresentationVector[n]->SetColor( 0.0, 1.0, 0.0 );
if ( n < m )
{
m_FiducialsPointList->value(n+1);
}
else
{
m_FiducialsPointList->value(0);
}
this->RequestChangeSelectedFiducial();
fl_beep( FL_BEEP_MESSAGE );
AcceptedLandmarkPointContainerType::const_iterator iter;
iter = m_AcceptedLandmarksContainer.begin();
unsigned int numberOfAcceptedLandmarks = 0;
for (;iter != m_AcceptedLandmarksContainer.end(); iter++)
{
if (iter->second)
numberOfAcceptedLandmarks++;
}
if ( numberOfAcceptedLandmarks >= 3 )
{
m_RegisterButton->label("Ready");
m_RegisterButton->color(FL_GREEN);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20100614/0b9b899b/attachment.html>
More information about the IGSTK-Users
mailing list