Want to keep learning?

This content is taken from the University of Basel's online course, Statistical Shape Modelling: Computing the Human Anatomy. Join the course to learn more.
2.8

University of Basel

Skip to 0 minutes and 6 seconds 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.

Skip to 0 minutes and 50 seconds 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.

Skip to 1 minute and 24 seconds 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.

Skip to 2 minutes and 1 second 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.

Skip to 2 minutes and 37 seconds 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.

Skip to 3 minutes and 19 seconds 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.

Skip to 3 minutes and 56 seconds 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.

Skip to 4 minutes and 33 seconds 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.

Skip to 5 minutes and 17 seconds So I recommend now that you go to the companion tutorial documents and give this a try for yourself.

From meshes to deformation fields

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.