Exported STL files from the segmentation has intersection/penetration

Operating system: Windows 10
Slicer version: 4.10.1

Hi everyone,

I want to create models for mandible and teeth from a CBCT scan. After importing the DICOM file to 3Dslicer and completing the segmentation process I used segmentations/export to export the segmentations as STL models. Then I import those STL files into Meshmixer and I found out the models have intersections! (the surface of the teeth model penetrates the surface of the bone model as you can see in the image). I noticed that 3D Slicer uses the Marching Cube algorithm in order to calculate surface mesh from the label map volume, which might be the reason why the estimated surface of one segment is penetrating the other segment’s surface. penetration

-I would like to know is there any way to solve this problem and avoiding any penetration in the exporting files?

  • The voxel size of my data is 0.3x0.3x0.3mm. I have tried to create an empty space with 0.5mm width by shrinking the margin of the teeth segment by 0.5mm, and then exporting the models. Hopefully, my models do not have any intersection with the empty space between them. However, I am curious to know whether there is any better way to avoid such intersection problems.

Thank you in advance for your help

You can reduce chance of overlap by applying Smoothing effect with Joint smoothing method, decrease the voxel size (using Crop volume module), and/or reducing the smoothing factor (drop-down in Show 3D button).


Hi @Tekk_ya - please describe the exact steps you follow in Slicer that leads to this result, ideally reproducible on existing sample data, or if needed on data you can share.

For segmentation, did you the old “Editor” module or the new “Segment Editor” module. If you have used the segment editor module, it is lot easier to remove intersections/overlaps using the ‘Logical operators’ tool. You the ‘subtract’ overlap regions of a segment with others.

Hi Steve,

I segmented the CBCT scan by using “Segment Editor” module as follow:
First, I segmented the teeth by utilizing the threshold tool. Second, I modified the segmented parts by using the paint and erase/scissors tools to segment the teeth perfectly. I also used the “Island” tool to remove the small segments. Then, I segmented the bone by using level tracing without overwriting or modifying the teeth segments. I also tried the “Logical Operator” tool to subtract any possible overlapping and to avoid any intersection in the exported models. However, the problem is not in the segments that i have and they are completely separate and there isn’t any overlap between them but after exporting them as STL models I face intersection problem.

Could you suggest any faster method to segment the teeth from the bone? is there any extension in 3D Slicer that I can use for this type of segmentation? I have tried to go through the 3D slicer tutorials but unfortunately, none of them works for segmenting the teeth from the bone. (It is hard to segment the teeth from the outer part of the mandible as the bone is denser in those areas and the intensity of the bone is close to the intensity of the teeth which makes it difficult to segment them with automatic or semi-automatic tools.)

I would really happy to receive any suggestions for a better and more efficient way of segmenting the bone and the teeth since I am planning to segment many scans using Python scripts if possible.


Thank you for your reply. I have tried that tool and found it really useful. but even after subtracting the segments still, I have the same problem.

Hi Andras,

Thank you for your reply. Increasing the resolution of the CBCT scan by applying the B-spline method did not help me (maybe because I am not re-segmenting the scan and I just want to export the segments that I have in a such way that they don’t have intersection)

I solved the intersection problem by resampling the labelmap geometry in “Segmenter Editor”. I tried to “oversample” the space by a factor of 4. It solved the intersection problem.
I wonder the reason behind this! Would you explain it based on the 3Dslicers code related to this function? or share a link related to the source code of this function. Would you explain to me how it affects the exported files? Does it increase the resolution of the labelmap and consequently the marching cube method can estimate the surface triangles more accurately?

Please correct me if I am wrong.


1 Like

Exactly. Labelmap voxels are rectangular prisms while surface mesh is a smooth surface, so a smoothing operation is needed, which may introduce gaps or overlaps the size of a fraction of a voxel. If the voxel is too large enough then this fraction of a voxel difference may matter.

@Tekk_ya you might try a slightly different pathway to get “watertight” models.

  • export the segmentation to a label map
  • run the ModelMaker module with the “Joint Smoothing” operation enabled

what this will do is apply the same smoothing operation to matching vertices from the different segments so that no gaps are introduced. In the example below the yellow/green surfaces use the default and the red/blue use Joint Smoothing.

@lassoan I don’t see that the segmentation closed surface option exposes the same version of Joint Smoothing. The one in ModelMaker was specifically designed by @Lorensen to generate watertight models for 3D printing.




Joint smoothing is available in Segment Editor too, no need to do the complex workflow with exporting and Model Maker. See screenshot below.


The only difference compared to joint smoothing in Segment Editor compared to Model maker is that joint smoothing result is converted back into labelmap representation. This makes some very little difference in the final surfaces.

Maybe in the joint smoothing method we could add the option of changing master representation to closed surface model. Then we could store the joint smoothing result as is, instead of recomputing it from the labelmap. Since switch to labelmap representation happens automatically when segment editor tools are used, maybe we could always switch the master representation.

Yes, this is the difference - if you want to export the watertight surfaces you can’t re-rasterize.

Right. Changing the master as @lassoan suggests might e a good idea to simplify this.

You mean change the master to closed surface when using joint smoothing without asking and then back when using another effect after that?

Yes. I think the automatic switching mechanism is already implemented (triggered by activating a segment editor effect), so it may be easy to change the behavior.

It works remarkably well, even with re-rasterizarion. The difference is in the range of fraction of a voxel.

Have you tried to get better surface mesh using e.g. SlicerMesher or SlicerMeshing

@Tekk_ya it’s hard to tell what’s going on from the screenshots - can you share the data?

For me the screenshots show that everything works great. The random pattern visible at the joint teeth/bone surface indicates that the surfaces are accurately matched. You will only have the teeth strictly on one side of the bone if you add clearance between the bone and teeth (e.g., using Margin effect). You can represent arbitrarily small distance between surfaces by decreasing the spacing in segmentation.

You can decrease the smoothing factor to lower values, if you find that important details are removed by smoothing.

I tried your suggested solution. However, when I use the model maker with joint smoothing, although the boundary lines are similar to the red/blue one you have shown here, still sometimes they cross each other which results in segments penetration in those areas.

There is always some amount of numerical imprecision, so if you cannot tolerate even the slightest overlap between segments then you may need to add some clearance between segments (using Margin effect), disable smoothing, or work with labelmaps instead of meshes.

Maybe this will be the best solution for you. This way the slice intersections will be choppy, but the vertices will coincide.