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

Andras Lasso lasso at queensu.ca
Tue May 9 00:05:35 EDT 2017


Hi Youngkyun,

Probably you would be better off using free, open-source VTK-based libraries for tracked ultrasound imaging, which take care of all these low-level details.

For example, the PLUS toolkit (www.plustoolkit.org), which I'm one of the core developers of, can connect to a wide range of tracking devices and ultrasound systems, calibrate the system, compute all transforms automatically (you just specify the name of the transforms that you know and it computes all the transforms that you ask for), can visualize tracked ultrasound image and tools, stream data through OpenIGTLink protocol to compatible applications, reconstruct volume from tracked sequences, supports 4D ultrasound image acquisition, generate simulated ultrasound images, etc.

You can use SlicerIGT (www.slicerigt.org) for building clinical-grade surgical navigation systems with tracked ultrasound without any programming. It's also free and open-source.

If you still want to build your own software from scratch then you can use all these components as examples, just copy-paste as you like. I would still recommend to use these toolkits as they are, instead of redeveloping everything, because by the time you extract and stabilize what you need, you would miss all the new features that we add in the meantime. Also, if you build on an existing platform then you can get lots of help from experts who use the same platform.

Andras

-----Original Message-----
From: vtkusers [mailto:vtkusers-bounces at vtk.org] On Behalf Of Youngkyun, Park
Sent: Saturday, April 29, 2017 7:44 PM
To: vtkusers at vtk.org
Subject: [vtkusers] How to transform actor - probe - optical tracking system?

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.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list