Perform graph cut

I intend to use graph cut segmentation on a VTK volume, and I saw few examples on github. But all these examples are using images (background and foreground images) as masking for graph cut … what should I use for VTK volume, because in this case I don’t have “images” as mask …

Do you know any place from where I can inspire for this task ?

Thank you.

P.S. Or, what is the best approach to cut a little piece from a vtk volume ?

Having “foreground” and “background” seeds is the essence of graph-cut methods. They can be somewhat adapted, e.g. to only have the user place one seed point in 2D or 3D.

If you don’t have seeds, you need to construct them somehow. Or just don’t use graph cuts.

You mean 3D volume? If you have a VTK image you need to convert it to ITK in order to apply ITK filters.

We might have advice if you show us example input image and desired result (you can do that manually). Or at least describe it more thoroughly.

I have a vtkVolume, and I have methods that convert vtkVolume into SimpleITK (sitk::Image) not ITK !!! because working with SimpleITK is much faster than ITK :slight_smile: .

I can take any point from 3d vtkVolume through vtkVolumePicker or vtkCellPicker, whatever … now, I don’t know how to use them into graph cut algorithm, because I’ve found on github some code from here I can inspire, but that code uses images as foreground and background, but not points…

Here is my model:

Here is my vtkVolume sample (a CBCT):


I can pick a 3D point as I said before with vtkCellPicker or vtkVolumePicker, but I don’t know how to use them to cut a tooth from there … I was thinking to use graph cut …

Get 3D coordinates of the point from VTK picking, and then you should be able to use them in ITK as physical coordinates. If you are using VTK 8.2 or earlier, you will need to take special care if direction matrix is non-identity.

Use TransformPhysicalPointToIndex if you want to get ITK index. Then put a seed there or around a small neighborhood of that voxel.

1 Like

@flaviu2 before you start implementing anything, I would recommend to try existing tools in various open-source software. Once you confirmed what algorithm fulfills your needs, you can start thinking about the final implementation.

3D Slicer has many segmentation tools (automatic, semi-automatic, and manual) in its Segment Editor module that you can easily try. For example, its “Grow from seeds” effect uses a variant of grow-cut algorithm that is optimized for 3D medical image segmentation. It is expected to work better than a generic graph cut implementation. See tutorials of this and the many other segmentation tools here. You can also easily make new segmentation tools out of SimpleITK and VTK filters (you can use existing effects as examples - they are all based on ITK and VTK filters).

For bone segmentation, you’ll also need tools to solidify segments (to remove internal holes and surface discontinuities).

There are a number of Slicer forum members that are experienced in teeth and CMF bone segmentation, so it you have a specific clinical problem to solve then you may ask the experts there.