Apply homogeneous transformation matrix

25 views
Skip to first unread message

Maia R.

unread,
Aug 26, 2020, 3:12:08 PM8/26/20
to scalismo
Hello,
I have homogeneous transformation matrices  (4x4) that combines rotation and translation and I'd like to apply those matrices to my meshes.
Is there a function in Scalismo that does that ? I only found 
val rigidTransform: RigidTransformation[_3D] = RigidTransformation[_3D](translation, rotation)
which combines a rotation and a translation. In addition, we must know the Euler angles in radians beforehand.
Thank you
Maia

Maia R.

unread,
Aug 26, 2020, 5:00:55 PM8/26/20
to scalismo

Another question, in the tutorials, a rotation center rotationCenter = Point(0.0, 0.0, 0.0) is used.
Could you explain why this is equal to (0,0,0)  ?
Thank you

Marcel Luethi

unread,
Aug 27, 2020, 2:55:06 AM8/27/20
to Maia R., scalismo
Dear Maia

There are currently no transformations in Scalismo, which use homogeneous transformation matrices. Instead we build transformations by composing several simpler transformations.
It is, however, simple to write that yourself if you need it. Just extend the trait Transformation[_3D] and override the method f. Here is an example

import scalismo.common.{Domain, RealSpace}
import scalismo.registration._
import scalismo.geometry._

class MyOTransformation extends Transformation[_3D] {

override val f: (Point[_3D]) => Point[_3D] = {
// implement your transformation here. E.g.for a flipping trasnformation
p => Point3D(p.x, p.y, -p.z);
}

override def domain: Domain[_3D] = RealSpace[_3D]
}

The rotation center should usually be chosen such that the rotation is performed around the center of mass of the object you want to rotate. Typically this is not (0,0,0). I only choose a center of 0,0,0 when I do a landmark registration, where the rotation matrix can be computed analytically.

Best regards,

Marcel

ps.,  Transformations in Scalismo are currently a mess. In the next version of Scalismo, that we plan to release shortly, they will be completely redesigned.

--
You received this message because you are subscribed to the Google Groups "scalismo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalismo+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalismo/b67469d6-fb30-416a-9f62-e906f66cf9f6n%40googlegroups.com.

V R

unread,
Aug 27, 2020, 8:08:21 AM8/27/20
to Marcel Luethi, scalismo
Dear Marcel,
Thank you for the explanation. I extracted the rotation and the translation matrices from my homogenenous matrix and used Scalismo, with center(0,0,0). 
It has improved the registration between the mesh and the landmarks, but there are still shift. I will try to change the rotation center and your suggestion.
Best regards,
Maia

V R

unread,
Aug 27, 2020, 11:35:11 AM8/27/20
to Marcel Luethi, scalismo
Dear Marcel,
Being able to apply homogeneous transformation matrix is definately useful: I managed to get the correct transformation when applying it on my mesh with 'another' software. 
Best regards
Reply all
Reply to author
Forward
0 new messages