Page MenuHomePhabricator

Tooltip computation is buggy
Closed, ResolvedPublic

Description

So far the computation of the tooltip of the mitk::InternalTrackingTool is not tested and might be buggy.

Thus:

  • Test this relatively new feature: write a unit test and make some application testing with different tracking systems.
  • Fix the tooltip computation if it doesn't work.

Event Timeline

There also was a comment on this bug on the mailing list:

I am trying to understand the computation of the tool tip position and orientation that is done in mitk::InternalTrackingTool::GetPosition() and mitk::InternalTrackingTool::SetPosition(). Currently these methods have:

void mitk::InternalTrackingTool::GetPosition(mitk::Point3D& position) const
{

// ...
vnl_vector<float> pos_vnl = (m_ToolTipRotation.rotate(m_Position.Get_vnl_vector()))+ m_ToolTip.Get_vnl_vector();
// ...

}
void mitk::InternalTrackingTool::GetOrientation(mitk::Quaternion& orientation) const
{

// ...
orientation = m_ToolTipRotation * m_Orientation;
// ...

}

But on paper I show that it should be:

void mitk::MyTrackingTool::GetPosition(mitk::Point3D& position) const
{

// ...
// Compute the position of tool tip in the coordinate frame of the
// tracking device: Rotate the position of the tip into the tracking
// device coordinate frame then add to the position of the tracking
// sensor
vnl_vector<float> pos_vnl = m_Position.Get_vnl_vector() + m_Orientation.rotate( m_ToolTip.Get_vnl_vector() ) ;
// ..

}
void mitk::MyTrackingTool::GetOrientation(mitk::Quaternion& orientation) const
{

// ...
// Compute the orientation of the tool tip in the coordinate frame of
// the tracking device.
//
//   * m_Orientation is the orientation of the tracking sensor in the tracking device coordinate frame
//   * m_ToolTipRotation is the orientation of the tool tip relative to the tracking sensor
orientation =  m_Orientation * m_ToolTipRotation;
// ...

}

Empirically testing with our tracking device shows that this is correct. Of course this assumes that the tip position and tip orientation are relative to the coordinate frame of the tracking device sensor. Is this an incorrect assumption for the mitk::InternalTrackingTool class?

I updated the pull request with some other bugs I found in InternalTrackingTool - I figured they all sort of fall under the description of "Tooltip computation is buggy"

New remote branch pushed: bug-15715-FixTooltipComputation

Taylor,
thanks for your commits. We just integrated your first commit of this bug regarding the composition of tracking and tooltip transformation.
Regarding your remaining commits we will take care later on.
Anja

New remote branch pushed: bug-15715-Tooltip-computation-is-buggy

New remote branch pushed: bug-15715-IntegrationBranch

I merged all commits from Taylor Braun-Jones, which belong to this bug, in the IGTCodingBase2-branch. This branch will be merged soon into the master, so that the new functionalities are accessible for every user.