vtk paintbrush (segmentation)

At one point there was a vtkedge library that had some paintbrush functionality. Supposedly that has been absorbed by vtk, but I can’t seem to find any paintbrush options in vtk. Is there a recommended way to go about changing a vtkImageData using a circular brush? Thanks.

1 Like

I’m working on that now in the context of medical contouring/segmentation!
Currently I create a custom InteractorStyle class inheriting from vtkInteractorStyleImage. I then override OnMouseMove(), OnLeftButtonDown() and OnLeftButtonUp(). I use a vtkCellPicker to get the world coordinates of the click, then vtkRegularPolygonSource to create a circle centered at the click coordinates. I boolean add these circles together as I’m drawing to get the final contour. I’m not sure if this is at all a good way to do it, but it’s been working for me!

Thanks, I’m doing something similar now, except modifying the vtkImageData pixels directly rather than creating a vtkRegularPolygonSource. It felt a bit clunky, but I guess this is the proper approach for the moment.

Hi, I am using very similar solution (I just modify vtkImageData) but I have problem with interactions. How do you manage handling events for drawing. I would like to have drawing when left mouse button is pressed and mouse is moving. Is there a combination of mousemove and handleLeftButtonPress) I could use in?. What do you use?

I tried to use PantFilter and PaintWidget, but this was overwriting my all handlers.

I set the interactor of my plane renderer class to my custom interactor, inheriting from vtkInteractorStyle.
Within that interactor I override OnMouseMove(), OnLeftButtonDown() and OnLeftButtonUp().
I do not use PaintWidget at all.

Thanks, I will use the same.