Automatic paint tool along curve


I want to implement a paint tool that can automatically follow a path so I can set the radius and threshold and get the segmentation from the beginning to the end of the curve. Can anyone give some idea how to do it?


With some python scripts you can do that. You could look at the Endoscopy module and the Segment Editor code to find the logic parts you would need. Tracing along a curve with threshold painting could be a good way to segment faint vessels.

1 Like

You may have a look at the ‘Curve centerline extraction’ module in SlicerVMTK extension, that you can install from the ‘Extension manager’. It segments along a curve using ‘Flood filling’ and not ‘Paint’ tool. You can specify the radius, and tune the intensity range until you get a satisfactory result. Very poorly contrasted vessels may be out of scope though.

1 Like

Filling a segment around a curve with a specified radius is already available in the “Draw tube” effect in Segment Editor, after you install “SegmentEditorExtraEffects” extension.

1 Like

But we are interested in adjust radius and intensity in each point given some conditions. Maybe the easiest way to do it is modify “Draw tube” code?

Sample images would be helpful.

What would you like to achieve? Generate a vascular network? Would you like to get a surface mesh or synthetic CT as output? Where do the input curves come from?

Yes, we want to generate vessels having in count the curve points neighbourhood, so we can adjust parameters like radius or threshold.
Pseudocode may look like:

curve = MarkupsCurve(...)
for point in curve:
      radius = adjustRadius(point)
      threshold = adjustThreshold(point)
      applyPaint(point, radius, threshold)

We want a segment as output.

Thanks :slight_smile: