Edit Segmentation Locally

I have recently developped a module that segments an MRI based on edge/contour detection. However, some of the time, those contours aren’t “perfect”. For instance, sometimes they’re not closed. Other times, they’re too small or too large so I’m looking for a way to be able to edit them locally. For example, I would like to develop a tool that would allow me to drag the contour to stretch it or compress it. Or maybe a tool where I would mark a point in the image and the contour would go to it. However, I don’t really know where to begin to develop such a tool. I’ve tried looking into markup points but I don’t see how I can use them in this case. Does anyone have any ideas on how to proceed from here?

Thank you in advance.

You can use markup curves.

Note that neural networks such as nn-UNet and MONAI Auto3DSeg are so successful in image segmentation tasks that they make most previous approaches completely irrelevant. Instead of trying to fix some imperfect contours, I would recommend to consider using neural networks for segmentation.

What do you segment on what kind of images? We may be able to point to pre-trained models that can do the task already.

1 Like

How would I use markup curves to edit the segmentation?

I am working with MRI images of the hepatobiliary system and I am segmenting the bile ducts. Here’s an example on one of the slices:


I haven’t tried any models for bile duct segmentation, but there are lots of models out there. You can simply google for bile duct segmentation model maybe also add github to find those that are openly available. They are most likely work significantly better than any contour based methods.

If you want to edit segmented bile ducts (provided by either AI models or some classic approaches), you can post-process the images a bit (e.g., Smoothing effect in Segment Editor) and then use VMTK extension to reconstruct a centerline.