# problem about the extents of output image in vtkResliceImageViewer when crosshair moving

**URL:** https://discourse.vtk.org/t/problem-about-the-extents-of-output-image-in-vtkresliceimageviewer-when-crosshair-moving/4540
**Category:** Support
**Created:** [November 1, 2020, 3:09pm UTC](https://discourse.vtk.org/t/problem-about-the-extents-of-output-image-in-vtkresliceimageviewer-when-crosshair-moving/4540 "2020-11-01T15:09:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![yuhuimoon](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/y/c6cbf5/32.png) [@yuhuimoon](https://discourse.vtk.org/u/yuhuimoon)
#### Post date: [November 1, 2020, 3:09pm UTC](https://discourse.vtk.org/t/problem-about-the-extents-of-output-image-in-vtkresliceimageviewer-when-crosshair-moving/4540/1 "2020-11-01T15:09:20Z")

</div>

I have realized the 2D viewers with 2D **vtkResliceImageViewer** and a 3D MPR viewer with **vtkImagePlaneWidget** in my demo. Now the MPR plane can update its cursor position with the 2D viewer crosshair moving. When 2D cursor moving, the reslice image I get has its new extents(bounds), which is larger than the extents(bounds) of the original image data (I draw yellow frame in the picture). The blank area is unnecessary for me. I want to get the same extent as the image data when moving the crosshair in the 2D viewer. What should I do?

 ![2020-11-01_222852](https://discourse.vtk.org/uploads/default/original/2X/a/a2df1aeedcbca2a54ae0615bd435af7239bc70b4.jpeg)

This is part of my code in the callback function of ResliceAxesChangedEvent. First to get the origin, point1 and point2. Then to update the position of the MPR plane.

```
for (int i = 0; i < 3; ++i)
{
    vtkResliceCursorWidget *widget = SliceViewManager::getInstance()->getSliceCursorWidget((ImgPlane)i); //the widget is from the vtkResliceImageViewer

    double origin[3], point1[3], point2[3];
    widget->GetResliceCursorRepresentation()->GetPlaneSource()->GetOrigin(origin);
    widget->GetResliceCursorRepresentation()->GetPlaneSource()->GetPoint1(point1);
    widget->GetResliceCursorRepresentation()->GetPlaneSource()->GetPoint2(point2);

    view->callUpdateImagePlane((ImgPlane)i, origin, point1, point2); //call to change the plane in MPR
}
```
