# Get coordinates from VTKBorderWidget

**URL:** <https://discourse.vtk.org/t/get-coordinates-from-vtkborderwidget/14235>\
**Category:** Development\
**Tags:** code\
**Created:** [July 15, 2024, 12:02pm UTC](https://discourse.vtk.org/t/get-coordinates-from-vtkborderwidget/14235 "2024-07-15T12:02:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KSJ](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ksj/32/8659_2.png) [@KSJ](https://discourse.vtk.org/u/KSJ)\
**Post date:** [July 15, 2024, 12:02pm UTC](https://discourse.vtk.org/t/get-coordinates-from-vtkborderwidget/14235/1 "2024-07-15T12:02:49Z")

</div>

Hello,  
I have a program where i am loading a DICOM directory and displaying the sagittal 2d image . In that image i am using a VTKBorderWidget to select a particular region and give that region to VTKExtractVOI.  
this is my code snippet:

```auto
vtkCoordinate* upperRightCoordinate =
                static_cast<vtkBorderRepresentation*>(m_borderwidget_1->GetRepresentation())
                ->GetPosition2Coordinate();
        double* upperRight;
        upperRight = upperRightCoordinate->GetComputedWorldValue(m_renderer);

vtkCoordinate* lowerLeftCoordinate =
                static_cast<vtkBorderRepresentation*>(m_borderwidget_1->GetRepresentation())
                ->GetPositionCoordinate();
        double* lowerLeft;
        lowerLeft = lowerLeftCoordinate->GetComputedWorldValue(m_renderer_mprwin);

```

Now i cannot set this directly to the extract voi as `extracteddata->SetVOI(lowerLeft[0],upperRight[0],lowerLeft[1],upperRight[1],0,number_of_slices);`  
so i used:

```auto
voi[0] = (lowerLeft[0] - imageOrigin[0]) / imageSpacing[0]; // where imageOrigin and imageSpacing are the dicom image origin and spacing

```

But iam not getting the region inside the VtkBorderwidget
