# initialize vtkBorderWidget with the click of the mouse

**URL:** https://discourse.vtk.org/t/initialize-vtkborderwidget-with-the-click-of-the-mouse/2519
**Category:** Support
**Created:** [January 30, 2020, 4:28pm UTC](https://discourse.vtk.org/t/initialize-vtkborderwidget-with-the-click-of-the-mouse/2519 "2020-01-30T16:28:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [January 30, 2020, 4:28pm UTC](https://discourse.vtk.org/t/initialize-vtkborderwidget-with-the-click-of-the-mouse/2519/1 "2020-01-30T16:28:47Z")

</div>

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?

Thanks

---

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [January 31, 2020, 11:15am UTC](https://discourse.vtk.org/t/initialize-vtkborderwidget-with-the-click-of-the-mouse/2519/2 "2020-01-31T11:15:36Z")

</div>

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](https://discourse.vtk.org/uploads/default/original/2X/1/18d029f1a781d26a50b7644de44ad3352eb810c7.png)

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [January 31, 2020, 2:25pm UTC](https://discourse.vtk.org/t/initialize-vtkborderwidget-with-the-click-of-the-mouse/2519/3 "2020-01-31T14:25:58Z")

</div>

Would you like to implement manual image segmentation?

---

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [January 31, 2020, 2:30pm UTC](https://discourse.vtk.org/t/initialize-vtkborderwidget-with-the-click-of-the-mouse/2519/4 "2020-01-31T14:30:54Z")

</div>

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.

Thanks

---

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [February 4, 2020, 8:46am UTC](https://discourse.vtk.org/t/initialize-vtkborderwidget-with-the-click-of-the-mouse/2519/5 "2020-02-04T08:46:03Z")

</div>

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

![Screenshot_4](https://discourse.vtk.org/uploads/default/original/2X/0/0183ee49377cd9c06ae7e7eee16b618eab13c0d5.png)

---

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [February 5, 2020, 2:02pm UTC](https://discourse.vtk.org/t/initialize-vtkborderwidget-with-the-click-of-the-mouse/2519/6 "2020-02-05T14:02:23Z")

</div>

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.

Thanks
