DentalSegmentator result mesh is inverted

Hello, can someone help me please. I am using the DentalSegmentator Extension but the meshes come out inverted. I’ve been trying to change the settings for several hours but I haven’t been able to solve it. I thank you for your responses.

If that’s a surface (or mesh or, as Slicer calls them, modelNode) then you just need to execute a filter to flip the normals.
In Slicer you can do it like this:

Hope it helps

Thanks for your answer. I did what you told me but when exporting to STL it still gives me an inverted mesh. I still need help.


STL file cannot save surface normals, so you would need to reorient triangles if you want to turn the surface inside out. You could do that by applying vtkReverseSense filter (by running a couple of lines of Python code).

But it is probably better to fix the root cause of having an inverted surface.

What file format was the input image stored in? If NIFTI then you have a chance of getting into issues with image orientation. Using the latest Slicer Preview Release contain some error mitigation mechanisms that can help with NIFTI files.

How have you created the STL file? Have you applied any transforms? Are all the segments inverted? If you smooth the inverted segment a bit does the surface orientation gets fixed?

Why is it a problem that the triangles are oriented? What processing do you want to do in what software?

This is the second time I have used DentalSegmentator. The first time the meshes were oriented normally.
This second time all the meshes are inverted.
I haven’t done any transformations, this is how DentalSegmentation generated the segments.
Or is this how DentalSegmentator usually generates segmentation?

No specific program, it’s just my curiosity to be able to correct this orientation.

Thank you for reading.

PD. I’m afraid that Python code is something very complex for me.

Did you load the image from DICOM, NIFTI, NRRD, or other file format?

If you don’t have any specific task in mind then a simple option is to ignore the polygon ordering. Most software that can process meshes can also reorient the polygons automatically or when it is needed.

They were loaded from DICOM (CBCT).

The first time I did it through CT and this second time through CBCT.

I will continue testing. I still hope to correct the orientation.

Hi @Romulo_Alfaro,

For the cases where you have the inverted mesh problem, could you test the following :

  • Load the data
  • Go to the segment editor
  • Add segment
  • Select brush + Sphere brush
  • Paint a sphere in a 2D view
  • Export to files in STL (see screen capture below)
  • Check if the inversion is present in the exported sphere STL file

From my tests, an inversion case was coming from the input data frame of reference which didn’t match the expected one in 3D Slicer.

I implemented a tentative fixe for that in (#7627) which was successively patched by @lassoan for regressions by (#7773, #7746).

If the same behavior is still present in your data, we may have to see why it’s not properly taken into account.

Best,
Thibault

Thanks for your test!

If you have not already done so, could you do the same test using the latest 3D Slicer 5.7 preview version?

If the problem is still present, could you share one of the data you experience this problem?

I am using version 5.7 for Mac

Which version exactly?

I just used DentalSegmentator on other DICOM file (CT) and the orientation was correct. Apparently and so far, it only happens with CBCT files.

Could you take a screenshot of the IJK to RAS direction matrix in Volumes module?

Is the volume under a transform? (In Data module, if you right-click on the transform column in the volume’s row then is the “None” option is selected or some transform?)


Why do you have two segmentations and images?

Where/how did you use NIFTI? (The .nii suffix suggests that it may have been used)

Can you share an anonymized scene file (saved as a single .mrb file) so that we can investigate further?

i had couple of volume having distortion / compression issues with same module . i tried mona and had a good outcome .

1 Like

Thanks for the example file, it helped a lot confirming what was happening. The 479068 AXIAL.nrrd file uses left-handed coordinate system (space directions: (0.39999999999999997,0,0) (0,0.39999999999999997,0) (0,0,-0.40000000000000191)), which causes the segmentation to be turned inside out.

Have you used the DICOM browser to load the CBCT image (DICOM import in Data module)? Or you forced loading using the legacy image reader (Volume option in Data module)?

I’ve submitted a fix that should properly reorient the image when it is loaded using the DICOM browser. It will be probably integrated within a couple of days:

Is true. I just opened it by force loading using the legacy image reader and this time the orientation was correct. Only that Segmentation had some flaws.