[vtkusers] How to transform actor - probe - optical tracking system?

Youngkyun, Park youngkyunp at gmail.com
Sat Apr 29 19:44:22 EDT 2017


Hi, all, 

I'm make some freehand ultrasound system with NDI Polaris and ultrasound
diagnosis equipment.

I can get some points from a ultrasound image but transformation is problem.

Here is what am I trying to transform ;

<http://vtk.1045678.n5.nabble.com/file/n5743027/transform.png> 

And brief codes follow ; 

        // skip codes for pixels to points(used vtkPoints and vtkCellArray)

vtkSmartPointer<vtkMatrix4x4> tItoP = vtkSmartPointer<vtkMatrix4x4>::New();
vtkSmartPointer<vtkMatrix4x4> tPtoO = vtkSmartPointer<vtkMatrix4x4>::New();
vtkSmartPointer<vtkMatrix4x4> tUS = vtkSmartPointer<vtkMatrix4x4>::New();


	tItoP->SetElement(0, 0, 1);
	tItoP->SetElement(0, 1, 0);
	tItoP->SetElement(0, 2, 0);
	tItoP->SetElement(0, 3, -61.19);
	tItoP->SetElement(1, 0, 0);
	tItoP->SetElement(1, 1, 0);
	tItoP->SetElement(1, 2, 1);
	tItoP->SetElement(1, 3, 0);
	tItoP->SetElement(2, 0, 0);
	tItoP->SetElement(2, 1, -1);
	tItoP->SetElement(2, 2, 0);
	tItoP->SetElement(2, 3, 0);
	tItoP->SetElement(3, 0, 0);
	tItoP->SetElement(3, 1, 0);
	tItoP->SetElement(3, 2, 0);
	tItoP->SetElement(3, 3, 1);

        // array M is rotation matrix retrieved by NDI API
CvtQuatToRotationMatrix
        // array T is translation from NDI API
        // array m_dInitPos is the initial position

        tPtoO->SetElement(0, 0, M[0][0]);
	tPtoO->SetElement(0, 1, M[0][1]);
	tPtoO->SetElement(0, 2, M[0][2]);
	tPtoO->SetElement(0, 3, (m_dInitPos[1] - T[1]));
	tPtoO->SetElement(1, 0, M[1][0]);
	tPtoO->SetElement(1, 1, M[1][1]);
	tPtoO->SetElement(1, 2, M[1][2]);
	tPtoO->SetElement(1, 3, (m_dInitPos[0] - T[0]));
	tPtoO->SetElement(2, 0, M[2][0]);
	tPtoO->SetElement(2, 1, M[2][1]);
	tPtoO->SetElement(2, 2, M[2][2]);
	tPtoO->SetElement(2, 3, (m_dInitPos[2] - T[2]));
	tPtoO->SetElement(3, 0, 0.0f);
	tPtoO->SetElement(3, 1, 0.0f);
	tPtoO->SetElement(3, 2, 0.0f);
	tPtoO->SetElement(3, 3, 1.0f);

        vtkMatrix4x4::Multiply4x4(tPtoO, tItoP, tUS);

        actor->SetUserMatrix(tUS);


On running this code, translation is OK, but rotation is weird.

It seems .... It's hard to explain in text .... 

The most distinguishing situation is that actor is rotate also going up and
down when just rotating probe physically with Z axis of ultrasound probe
marker.

When I apply only tItoP to actor like "actor->SetUserMatrix(tItoP)", it's
OK. 
It represented same as physical position(ultrasound image and probe maker's
position).

What's wrong with my code? How can I fix?





--
View this message in context: http://vtk.1045678.n5.nabble.com/How-to-transform-actor-probe-optical-tracking-system-tp5743027.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list