initialize vtkBorderWidget with the click of the mouse

Dear all,
I want to obtain a ROI over an vtkimagedata (dicom) to perform certain statistics in that area (e.g., mean, std…). So i am using vtkBorderWidget. But i found out that it is always initialzed at the left bottom side of the image. And i do not understand why, it would be more logical to start the rectangle around the left click of the mouse.

So i tried to change the position in the widget representation to position it initially around the mouse position. But if i do that the mouse interaction is disabled. So i am not able to translate it anymore.

Has someone the same problem?. Is there any other widget that solves this issue?


I have tried to use a bounding box instead as i read it is a bug from vtkborderwidget and it works but as it is a 3d representation i get a divided rectangle to show a 3d bounding box so the visualization is very ugly. What i want to obtain is something similar to the image. Is there any widget in vtk to do that, or i have to implement it by myself redoing the vtkBorderWidget considering the mouse position in the initialization and removing the behavour to ignore the observers if a coordinate is defined? Thanks

screenshott area

Would you like to implement manual image segmentation?

Hi, thank you for answering.i am not implementing the segmentation of the image. It is only to show some statistics of the region selected in a text widget.


hello, what i would like to acheive is this but a rectangle instead of a bounding box. Any sugestion?. Thanks


I will make it with vtklinewidgets if someone is interested please let me know. It might be incorporated in vtk. As i think it can be very useful.