## 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.
1.13

## University of Basel

Skip to 0 minutes and 7 secondsWelcome to this first tutorial video on Scalismo. The goal in this video is twofold. So the first goal is to get familiar with Scalismo Lab environment. And the second goal is then to get acquainted with basic data structures that you will encounter often in this tutorial. So, hopefully, you managed to install Scalismo Lab easily. If you did, then you should have a setting that is similar to the one that you see here, where you have mainly three windows. So in the window here entitled, Scalismo Viewer, you have two main components. The first component is the 3D View here, where all of the 3D objects that we will manipulate will appear.

Skip to 0 minutes and 48 secondsThe second important component is the result pane that you see down here, where the result of the interpreted Scala operations will appear down there. The second important window in Scalismo Lab is this Scalismo code pane window, where you can actually type in your Scala expressions, as a simple expression here. And once you did that, what you could do is you can actually select this line of code, then press Shift Enter. And as you see here, you would get the result of this operation, appearing in the result pane, which means that this expression got interpreted by Scalismo Lab. The third window in Scalismo Lab is the one entitled, Scalismo tutorial.

Skip to 1 minute and 34 secondsThis contains the document of the tutorial that you should go through. So whenever you encounter example lines of codes in this tutorial in this document, what you can do is you can select the line, and then press Enter. And as a result of that, you'll see two things happening. So the first thing is that the line of code gets copied into this code pane here, which means that you can re-execute it at any point in time by pressing Shift Enter. And the second important thing is that the expression got evaluated by Scalismo Lab, and you actually see the result of this operation in the result pane here. So let's now have a look at the expression that we just executed.

Skip to 2 minutes and 20 secondsWhat we did here is we used the readMesh method of the MeshIO object to read a file called Paola.stl. And we assign the result of this operation to a variable called mesh, that is of type TriangleMesh. And TriangleMesh is a Scalismo class to define 3D surfaces. Now that we have our mesh, what we can do is we can add it to the scene. And we do this by calling the method show, specifying the name of the variable that we would like to show and also a name to attribute to it in the scene, and here we chose it to be Paola. And you see it here.

Skip to 2 minutes and 58 secondsNow we have the 3D face scan of Paola appearing in our scene, under the name that we chose for it.

Skip to 3 minutes and 8 secondsIn addition to 3D surfaces Scalismo also supports 3D medical images. And similarly to what we did before, what you do here is we actually now read an MRI scan of Paola. So here we use a method of the imageIO object to read the content of a file called PaolaMRI.vtk.

Skip to 3 minutes and 29 secondsAnd we assign the result of this operation to a variable named image, that we then show under the name mri in our scene. And you can see it here now appearing, that we have our MRI scan that is well aligned with our face. So let's first start by making the face invisible. So you see that our MRI scan is a grey valued 3D image. And we can actually access the contents of this image by slicing through the scene, by going here under the elements scene and then using the sliders to actually slice through our image.

Skip to 4 minutes and 18 secondsIn addition to medical images, Scalismo has the unique feature of supporting statistical shape models. So and pretty much the same, we can now read the statistical shape model and display it here. So to read statistical shape model, you use a method of the StatismoIO object. And here we're reading a file called bfm.h5. Now H5 is the file format that we use to store statistical shape models. It's a file format supported by the Statismo library, that is a C++ library, that defines this file format. And, hence, this is why we use this name here in the object StatismoIO.

Skip to 5 minutes and 2 secondsSo let's have a look now at our face model. But first, make the image invisible.

Skip to 5 minutes and 12 secondsSo you see that the face model is also a 3D scan or a 3D face, but contrarily to the previous shape, it's not a single face, it's actually a space of faces, or a normal distribution of faces. So what we can do here is we can go now on the instance of this model, and then we can sample random faces from this model. And you see that given that this is a face model, all of the instances out of this model are actually valid faces.

Skip to 5 minutes and 47 secondsIf we now continue in this tutorial document, we reach an exercise step. A very important thing to know about these steps is that they are optional. We strongly advise you to give them a try because they will give you a better understanding of Scalismo and shape modelling concepts. But if you have a hard time solving them, then remember they are optional. You can continue going through the tutorial document and execute the example code without being blocked at this step. So I now encourage you to go to the companion documents to this tutorial video and give the exercise a try.

# Hello Scalismo!

Get familiar with the Scalismo Lab environment and learn how to use it to read 3D surfaces, medical images and statistical shape models from file and display them in a 3D scene.

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