Generating 3D printable mesh models of brain arteries
By Piotr Mokry
The previous articles about described some of the challenges we faced in processing 3D meshes of aneurysm models in the brain. These articles mainly described the issue of generating an optimal (under certain assumptions) connection between the vessel model to some well-defined location in space to ultimately produce a physical 3D printable models.
Let’s talk about
our 3D modelling solutions!
The previous publications described the process of finding the optimal (based on a given definition of the cost function) points from where the connection would start, then generating the target mesh along the generated connection smoothly transitioning from a circular shape to the one obtained from the cross-section of the original anatomy.
In this article, the author will focus on the last step, which functionally used all the algorithms developed for the previous steps, and consisted of creating walls around the 3D model that had a pre-set thickness over the entire volume, without changing the anatomy relative to the initial model, to ensure the mechanical properties of the resulting printout. The process was supposed to be automated (except for setting a specific thickness of the vessel), but it had to provide a certain target shape for further tight placement in the physical flow simulator.
[Im. 1 3D model with generated offset]
Preparing the Model for Printing
The main objective of the created tool was to prepare a 3D printable spatial mesh based on a pre-set 3D model (mesh), and the description of the locations where a specific model was to be connected to the simulator (coordinates including the direction of the inlets). As a whole, the preparation of such a 3D printable models consisted of the following steps:
- Model cleaning up by removing unnecessary branches with a safety margin.
- Determination of the locations in the space where the vessel is to be connected.
- Generation of pipes connecting the model to these locations ensuring the least possible change to the main model.
- Generation of walls.
- Preparation of the ends of the generated model to connect it to the simulator.
The first three steps have already been described in other articles, in this one we will cover the last two.
3D printable models – the last step
The last operation that prepares the 3D printable models is the generation of walls with a pre-set thickness.
In the author’s project, several additional assumptions and constraints were imposed on this step. In general, the process boiled down to the following: to cut off the closing fragments from the target vessel (which already had pre-generated connections, described in the previous articles in the series); to generate an iso-surface for such a mesh, which would be equidistant from the initial mesh over the entire volume of the vessel; to prepare the end (functionally, this was to be done by Boolean subtraction of the mesh from the tube representing the connection point) to fit as tightly as possible into the element (the applied ring), which ensured tightness and stable attachment of the element to the target structure.
Finally, the surface generated in this way, along with the prepared end for connection to the simulator, had to be connected to the output model.
Generation of Iso-surfaces
The issue of creating a kind of envelope, that is, a surface equidistant from the pre-set surface in space, even with an analytical description of this surface, does not seem to be a difficult process, but it is highly dependent on the properties of this surface (mesh). This surface is not described analytically and may have some kind of anomalies that can significantly affect the process (such as a small distance between each branch of the model).
In addition, the process was to be automated and not alter the original model in order to disturb the physical properties of the model as little as possible. To this end, the first step was to create a binary mask with the best possible resolution based on the pre-set surface mesh (within reason due to limited computational capabilities and some time overhead on the whole process). With this mask, the Euclidean Distance Transform was determined, or more precisely, the transform applied to the area outside the generated mask. Then an iso-surface in the form of a mesh was created, which had a constant, pre-set distance from the initial vessel over the entire volume. The surface generated in this way, for example, due to rather low output resolution of the surface, may have had some disturbances, and places where the distance deviated from the assumed one. To this end, it was tested whether for each vertex of the envelope the original model at a pre-set distance was found. If not, the vertices of the envelope were slightly offset along the gradient (the EDT determined). After slightly smoothing the resulting mesh (Laplacian smoothing), the distance of the vertices was checked again, and depending on whether the desired accuracy was obtained or not, such an offset was made again.
[IM 3D model with transparent offset]
[IM mesh before and after smoothing]
Creation of the outlet
When preparing the aneurysm model, which was eventually to be connected to a kind of simulator (after 3D printing), it was necessary to ensure the best possible (for example in terms of tightness) connection to this simulator.
The position of the locations, to which the model was to be attached, in space was known (in relation to the coordinate system oriented with respect to the model being processed) and the 3D model of the elements, to which the model being processed was to be attached, was available. According to the processes described in earlier articles, the connections (pipes) from the original model to these target sites were generated (in addition to the location of these sites, the information about the directions and turns of these connections, as well as their diameter was also key), meeting the assumptions and constraints on the shapes (including the radius of curvature) and length of the connection so generated.
Another important detail was that the diameter of the element into which the printed model was to be inserted was larger than the pre-set diameter of these outlets (taking into account the wall thickness).
3D printable models – different approach
Taking into account the above assumptions, it might have seemed that the process of creating such an end would not be complicated either, since in order to obtain such a tight connection, it would be enough to perform a simple operation that would subtract the 3D model of the aforementioned connection from the 3D model of the aneurysm with generated walls. Unfortunately, the subtraction of 3D meshes is itself a difficult and unstable operation, so a completely different approach had to be used. Well, instead of subtracting these meshes from each other, the authors were able to algorithmically determine all the triangles in the centre of the mesh of this connection and use exactly this mesh to make a direct connection to their model (connection using the algorithms described in the article on connection sweeping).
What we did
In order to obtain this mesh, the information about the position of the end of this connection in space and its direction was used. The authors used this information to define a certain straight line, along which they then moved. Then, the authors moved along this straight line with a fixed accuracy, and, in each of these steps, they made a projection of “rays” (raycast/raytrace) to detect collisions of a given connection (end) with the mesh thus detecting (lighting up) the triangles from the mesh of a given end. However, it was necessary to remember to cut off the detected collisions outside a certain margin (taking into account the pre-set end diameter and the pre-set mesh thickness from the previous step), so as not to include the triangles that disrupted the final shape. In addition, in the process of testing such detection, it was discovered that the accuracy of the defined end parameters (position in space and direction) was subject to some inaccuracy, which had a major impact on the generation of these output tubes (offset relative to the real centre of the tube could, for example, result in too restrictive rejection of triangles because their distance from the ray source was too small/large). For this purpose, a series of iterative autocorrections were imposed in respect of this straight line from which the rays started. This process was repeated for each of the connections.
[IM Representation of tube along with raycast]
Connection to the Output Model
As a final step, using the connection sweeping approach, the iso-surface was trimmed to the dimensions and position of the generated tubes, intermediate circles were created to which both the iso-surface and tube were attached (in some places, the addition of closing rings/disks was required to make the final model tight (in the sense of a mesh, which was a prerequisite for 3D printing to be possible). The algorithm with connection sweeping involved several sites. It required the use of an intermediate, closing disk at the junction of the envelope and tube. The very end of the vessel and tube also had to be closed with such a disk, then the envelope and end had to be connected to the output 3D model in the same way.
[IM Attached end with coloured parts — offset/bridge/external tube/internal model]
3D printable models: summary
The task of generating an envelope, i.e., an equidistant mesh from the output model, along with matching the connections to the simulator, was a really interesting challenge. The authors were able to automate a difficult process that was previously carried out with sophisticated solutions, software and CAD tools performed by a skilled technician. Using the existing tools created within Graylight Imaging, or extending them, it was possible to generate the pre-set model with great precision and assumed accuracy. Of course, there is still room for improvement in this field, for example, in order to make connections more flexible, especially when two branches are close to each other, but it can be improved with the toolkit created.
See the previous post by Piotr Fröhlich: Automatic and seamless connections for brain aneurysm mesh