Skip main navigation

From meshes to deformation fields

Watch Ghazi Bouabene transform a set of face meshes in correspondence into a set of discrete deformation fields that can be analysed in Scalismo.
6.2
Welcome back. The goal in this tutorial video is to understand how to look at the set of triangle meshes in Scalismo as a set of vector valued functions that we can then analyse using the Gaussian Process theory. So let’s immediately start by loading a set of data in correspondence and start by executing this piece of code here. So what I’m doing here is simply listing the content of this test faces directory and then taking the first three files in this directory. And then to every file f in this list of files, I’m actually applying the readMesh method. This means that now this data set variable is an index sequence of triangle meshes.
49.9
And then in this last line here, what I’m doing is simply looping on all of the elements of the data sets, and then displaying them in the scene using the show method and attributing them and name in this scene. And if we now look at our 3D scene, you see that we have three faces there are being displayed here, three triangles meshes. And we can now visualise them separately by making them visible and invisible.
83.8
So now that we have this data set in correspondence, correspondence means that if we’re interested in following the position of a particular point, we can actually locate this point on all of the triangle meshes in our data set. So in this particular case here, we’re interested in following the position of the point with identifier 610. That actually happens to be a point on the right cheek. And what we’re doing is for every mesh m in our data set, we’re retrieving the point position using the point method of this point identifier 610. And then we’re simply displaying this point cloud of three points in our scene.
121.2
And you see it here now if I zoom in and maybe colour them differently that we have now three point positions that, in every case, in each case, lie on a cheek of one of our faces. And these points are all corresponding points to the identifier 610. So you saw previously that to interpret a set of shapes as a set of deformation fields, we need to attribute a special role to one of the shapes. And here, for example, we pick this first element of our data set to be our reference shape.
156.7
Then once we attributed this special role to the reference, what we can do is now we can compute the deformation from this reference to other instances of our data set. And in this piece of code here, what I’m doing is I’m computing the deformation field from the reference to the second element in our data set. And what is happening exactly is that for every point identifier of the reference that is called ID now, what we’re doing is we’re retrieving the point position of this identifier on the second element of the data set, and we’re retrieving also the point position on the reference. And this is pretty much the same way we did it for the point with ID 610 before.
198.6
It’s just that we’re now doing it for every point identifier of our mesh. And once we retrieve these two positions, what we’re doing here is we’re actually computing the difference between the two points, which in Scalismo gives me a 3D vector or a vector 3D as the type here. And this is why, once we do this, we actually have an index sequence of 3D vectors attributed to this deformation1-variable. Now, if we want to visualise this deformation field, what we need to define in Scalismo is we need a discrete vector field that is a discrete vector valued function.
236.1
And we can define this by using the discrete vector field constructor here where we simply specify the domain on which this discrete function is defined and in this case, it’s the reference or the points of the reference mesh. And we also specify the values or the vector values that are attributed to these points. And these are simply the deformation vectors that we computed just above. And once we have this discrete vector field, we can also show it in the scene. So as you can see here, now we get a vector field or a discrete vector field that is defined on points of the reference.
273.3
And you can see this by noticing here that all of the vectors are actually starting from points that are on our reference mesh. And if we now visualise our first face and make it slightly transparent, then you see that all the tips of the vectors in this deformation field are actually pointing to points of this target mesh that is the second mesh in our data set. So you see that if we now do the same operation to other instances or other meshes in our data set, we actually can transform our set of triangle meshes to a set of reference mesh and discrete vector fields in Scalismo.
317.3
So I recommend now that you go to the companion tutorial documents and give this a try for yourself.

Learn how to view a set of surfaces that are in correspondence as a set of deformation fields.

This view is important as it allows us to apply the Gaussian Process methods you have seen to analyse shape variations in Scalismo, when given a set of surfaces as dataset.

Each tutorial video is followed by a companion document that you will find in the consecutive Scalismo Lab step.

This article is from the free online

Statistical Shape Modelling: Computing the Human Anatomy

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education