# Segmentation algorithm used in 3D Slicer

Hi,

I’m using 3D Slicer for tooth segmentation and I’ve created an stl model from ct scan (DICOM).
I’ve done that using Segment editor module.

Can someone tell me which segmentation algorithm is used in slicer to create an stl model from ct scan?

I don’t understand the question. You said you did all that. Am I misunderstanding something?

If you mean which algorithms are used for generating closed surface from binary labelmap representation of the segmentation: see implementation here. In short: vtkDiscreteFlyingEdges3D followed by vtkWindowedSincPolyDataFilter, vtkDecimatePro (optional), and vtkPolyDataNormals.

I need to write some theory about image segmentation and the things I’ve done in 3D Slicer. Since I used thresholding, I wanted to know the names of algorithms you used in implementation ( eg. k-means clustering).
I’m a student and new to this so I don’t understand this very well. It will be very helpfull if you could give me the names of some algorithms you used. Hope you understand what I’m trying to say.

Thank you @lassoan , I think you get my point. So, you used marching cubes algorithm and flying edges? I need to write something about this algorithms and I really want to write about algorithms that are implemented in slicer.

We did not use matching cubes. We used flying edges algorithm instead because it is faster. You can find description of the methods at the associated links.

1 Like

I see, thanks! Andras gave you the details, but if you’re looking for some text, then I can send you my PhD thesis in which these are described in detail (it will be publicly accessible in a few weeks but I can send you an unofficial copy).

1 Like

Thank you, that was really helpful!

@lassoan @cpinter
Hi, I have another problem. I have done tooth segmentation and I extracted two stl files, tooth crown and root .

My question is… Is it possible to do an automatic segmentation of the contact surface between two volumes in contact (crown and root ) that were themselves constructed by segment editor? It is needed to impose the boundary conditions so as to treat two volumes as two bodies in contact.

You can export segments to models and then use “Model to model distance” extensions to compute distance between them. You can visualize the distance using color mapping or set a threshold value to show only parts that are closer to each other than the chosen threshold value (in Models module / Display / Scalars section).

I got this

and then i set a threshold value to get this

Is it possible to save this last surface as stl file?
I tried to save it but when I load it, i got the whole crown (first picture), not the surface I wanted.

Adjusting display options in Models module does not alter the model’s geometry, just modifies display settings. You can create a new model node from the displayed thresholded model by copy-pasting this line into the Python console:

If you just need a list of point IDs where the distance is smaller than a threshold (for example, 0.5) then you can get it by a few lines of Python code:

import numpy as np
distances = slicer.util.arrayFromModelPointData(getNode('sphere'), 'Signed')
pointIDs = np.where(distances < 0.5)

(replace sphere by the actual name of the model node; and Signed by the actual name of the distance array)

1 Like

Thank you for your help. I created a new model and it’s fine now, but I can’t get a list of point IDs.

There was a typo in the sample script above (distanceValues <-> distances), I’ve updated it now.

1 Like