About shape alignment

39 views
Skip to first unread message

Bereket Workie Anteneh

unread,
Mar 10, 2021, 2:24:13 AM3/10/21
to scalismo
I am doing SSM of proximal femur bone. In my work, I have an arbitrary reference and target shape when align the the reference with the targets I got misaligned registration as shown in the screenshot below (the yellow image is the reference and the blue is target shape ). Registration2.png
Registration1.png
 How I can correct the alignment problem?

The code I used for the alignment is as shown below.
val reference = MeshIO.readMesh(new File("C:\\Users\\user\\Documents\\minimal-scalismo-seed-master\\data\\Model R\\1. Femur (1).stl")).get
ui.show(reference, "reference")

val refLandmarks = LandmarkIO.readLandmarksJson[_3D](new File("C:\\Users\\user\\Documents\\minimal-scalismo-seed-master\\data\\STL\\Subject 1\\First Trial\\PF1.json")).get

val meshLandmarks = reference.pointSet.pointsWithId.map { p => Landmark[_3D](p._2.toString, p._1) }.toSeq // get all vertices of the mesh as landmarks

val target = MeshIO.readMesh(new File("C:\\Users\\user\\Documents\\minimal-scalismo-seed-master\\data\\Model R\\27. Femur (40).stl")).get
val targetLms = LandmarkIO.readLandmarksJson[_3D](new File("C:\\Users\\user\\Documents\\minimal-scalismo-seed-master\\data\\STL\\Subject 1\\First Trial\\PF1.json")).get
val meshLandmarks1 = target.pointSet.pointsWithId.map { p => Landmark[_3D](p._2.toString, p._1) }.toSeq

val bestTransform = LandmarkRegistration.rigid3DLandmarkRegistration(meshLandmarks1, meshLandmarks)

val align = target.transform(bestTransform)
ui.show(align, "aligned mesh" )

With regards,

Andreas Morel-Forster

unread,
Mar 10, 2021, 2:56:22 AM3/10/21
to scal...@googlegroups.com

Hi Bereke

You are using the vertices of your meshes instead of the landmarks. Could it be that the shapes are not in correspondence? As you are already loading landmarks, why aren't you using those for the alignment step?

Best, Andreas

--
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/78034531-9575-4543-87e7-a31c6c42070en%40googlegroups.com.

Bereket Workie Anteneh

unread,
Mar 10, 2021, 9:03:39 AM3/10/21
to Andreas Morel-Forster, scal...@googlegroups.com
Okay, so to use landmarks instead of vertices for the alignment, which line of code should be refined?

With regards, Bereket

Marcel Luethi

unread,
Mar 11, 2021, 9:28:31 AM3/11/21
to Bereket Workie Anteneh, Andreas Morel-Forster, scalismo
Dear Bereket

Working with Scalismo requires that you understand the basic theoretical concepts, and know how they are represented in Scalismo. We are aware that this requires a lot of learning and we are happy to support you in this learning process as good as we can. However we cannot write the code for you or give you line by line instructions on how to solve your problem.

In case you need support beyond what we can offer on this mailing list, or if you even prefer that we write the code for you, we would refer you to our company shapemeans (shapemeans.com), which provides professional consulting services regarding shape modelling and Scalismo. 

Best regards,
Marcel

Reply all
Reply to author
Forward
0 new messages