Problem with Landmarks registration

97 views
Skip to first unread message

Grégoire Mathieu

unread,
Jul 6, 2017, 8:27:25 AM7/6/17
to scalismo
Hi
I have an issue with my code for rigid alignment. It was working well but 1 week ago it stopped working and I didn't change anything in my code. I tried to fix it but I didn't find any solution. Here is my code, maybe you can tell me if there is something wrong with it.


val landmarksfiles = new File ("data/Internship_project/HSdata/scapulaLM/").listFiles

  val landmarks = landmarksfiles.map{id => LandmarkIO.readLandmarksJson[_3D](id).get}

 /* val landmarksfiles2 = new File ("data/Internship_project/HSdata/humerusLM/").listFiles

  val landmarks2 = landmarksfiles2.map{id => LandmarkIO.readLandmarksJson[_3D](id).get}*/




  val refLandmarks = landmarks.head

  val reference =  dataset2(0)

  val center = landmarks(0).apply(5).point




  val alignedTransform = landmarks.tail.map { lm =>


    val rigidTrans = LandmarkRegistration.rigid3DLandmarkRegistration(lm, refLandmarks)

    rigidTrans

  }



  val alignedSet = ( 0 until 2).map{ d =>

   val align = dataset2(d).transform(alignedTransform(d))

    ui.show(align,"Aligned_"+d)

   // MeshIO.writeMesh(align, new File("data/Internship_project/HSdata/scapA/scapalign"+d+".stl"))

    align

 }



Regards

Grégoire Mathieu

Marcel Luethi

unread,
Jul 6, 2017, 10:38:01 AM7/6/17
to Grégoire Mathieu, scalismo
Hi Grégoire,

When you say that it is not working anymore, do you mean it does not
compile anymore, or that it does not produce the correct results? Do
you get an error message?

Which version of scalismo are you using? You will find the version
using the command:

> println(scalismo.BuildInfo.version).

In case you are using intellij idea, you should have a history of all
the changes (right click on the file and choose "local history").

Regards,

Marcel
> --
> 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 post to this group, send email to scal...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/scalismo/a1ccb8de-a430-436c-819a-bbc62856103a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Grégoire Mathieu

unread,
Jul 7, 2017, 4:22:48 AM7/7/17
to scalismo
Hi,
I mean that I do have a result but it's not correct and I don't have any error message.
I have the 0.4 version of minimal scalismo seed and 0.14 of scalismo.
Regards
Gregoire Mathieu

bouabene ghazi

unread,
Jul 7, 2017, 4:35:45 AM7/7/17
to scalismo
Hi Grégoire,

Not sure what you mean exactly with "not correct", but looking at your code it seems that your indices are mismatched
and that you are applying the rigid transforms to the wrong meshes. alignedTransform(0) is the transform from the first (non-reference) mesh to the reference, while dataset2(0) is the reference mesh.
So no surprise that the set ends up misaligned :)

Cheers,
Ghazi

Grégoire Mathieu

unread,
Jul 7, 2017, 6:08:51 AM7/7/17
to scalismo
Hi
Yes, you are right but it is because I tried to change my code but even when the indices are matching the meshes are misaligned.
Regards
Gregoire


Le jeudi 6 juillet 2017 14:27:25 UTC+2, Grégoire Mathieu a écrit :
Reply all
Reply to author
Forward
0 new messages