Scalismo Lab Final Correspondence Step

443 views
Skip to first unread message

Luke

unread,
Nov 12, 2017, 7:04:03 AM11/12/17
to scalismo
Hi,

I've worked my way through the course and having trouble with the final step.

As I understand it correspondence is achieved by morphing the statistical shape model into the target mesh, which produces a mesh that approximates the target with corresponding points to the prior model - which can then be saved as an .stl. However, I wish to have a shape in correspondence which is exactly the same as the target shape. I see the method used in the quickstart UI version achieves this at the end with the registrationTransform.andThen(projection) step. I've been able to execute this in the UI version. I wish to use this step in Scalismo lab and I'm having trouble writing the code to mimic this step. I have edited the return value of the recursion function in the tutorial  'Model fitting with ICP' to give newPoints the but I'm not sure where to go from there, any tips would be much appreciated?

Regards

Luke

Marcel Luethi

unread,
Nov 13, 2017, 3:00:04 AM11/13/17
to Luke, scalismo
Hi Luke,

Welcome to the scalismo community.

The easiest solution is to loop through the points of the fitting
result and find for each point the closest point. This can be done (in
scalismoLab) as follows:

val fit : TriangleMesh = MeshIO.readMesh(new File("dataset/noseless.stl")).get
val target : TriangleMesh = MeshIO.readMesh(new
File("datasets/noseless.stl")).get

val projectedPoints = for (fittedPoint <- fit.points) yield {
target.findClosestPoint(fittedPoint).point
}
val projectedMesh = TriangleMesh(projectedPoints.toIndexedSeq, fit.cells)

Note however, that unless your fit is already rather good, this can
lead to artifacts. For practical model building, we usually avoid
using the projection step.

I would also like to mention, that ScalismoLab is only meant as a tool
to get started. If you are planning to use Scalismo for more serious
research, it would maybe be a good point to switch to an IDE such as
Intellij IDEA or Eclipse. It makes working with Scala much more
pleasent and also allows you to work with more current versions of
scalismo. We have prepared a document which outlines the necessary
steps to switch to an IDE:
https://github.com/unibas-gravis/scalismo/wiki/From-a-Scalismo-Lab-script-to-a-Scalismo-application.

As a last remark: Depending on your problem, you may observe that you
can achieve much better results using an gradient based approach as
outlined in the Quickstart guide. We have presented the ICP approach
in the course since from a didactic point of view it fits much nicer
to the other concepts.

Best 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/923bf7f5-21d0-4c18-8f04-ef7507e7169e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Luke

unread,
Nov 13, 2017, 7:31:37 AM11/13/17
to scalismo
Hi Marcel,

Thank you for your rapid and thorough response I will be sure to look into all of the above

Regards

Luke
Reply all
Reply to author
Forward
0 new messages