# Get Wrong World position When Rotate Image Data

**URL:** https://discourse.vtk.org/t/get-wrong-world-position-when-rotate-image-data/11933
**Category:** Development
**Tags:** training, python, code
**Created:** [July 12, 2023, 1:51pm UTC](https://discourse.vtk.org/t/get-wrong-world-position-when-rotate-image-data/11933 "2023-07-12T13:51:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![m.h.shanazary](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/aeb1de/32.png) [@m.h.shanazary](https://discourse.vtk.org/u/m.h.shanazary)
#### Post date: [July 12, 2023, 1:51pm UTC](https://discourse.vtk.org/t/get-wrong-world-position-when-rotate-image-data/11933/1 "2023-07-12T13:51:47Z")

</div>

Hi  
I Get World Position With vtkWorldPointPicker Its Work When Have not Rotate image Data but When I Rotate VtkImageData its wrong working its my code Rotate And Method To Get Mouse position  
Method I get world position  
int[] eventPos = Renderer.GetRenderWindow().GetInteractor().GetEventPosition();  
vtkWorldPointPicker cellPicker =  
vtkWorldPointPicker.New();  
cellPicker.Pick(eventPos[0] , eventPos[1] , 0 , Renderer);  
double[] worldPosition = cellPicker.GetPickPosition();

Method I Rotate image Data

vtkImageSlice imageSlice = new();  
double[] c = reader.GetCenter();  
imageSlice.SetPosition(c[0], c[1], c[2]);  
imageSlice.RotateZ(angle);  
imageSlice.ComputeMatrix();  
imageSlice.Update();  
vtkMatrix4x4 matrix = imageSlice.GetMatrix();

```
        vtkImageReslice reslice = new();
        reslice.SetInputData(reader);
        reslice.SetResliceAxes(matrix);
        reslice.SetInterpolationModeToCubic();
        reslice.Update();
        return reslice;

```

pixel position of  
 ![PixelPosition](https://discourse.vtk.org/uploads/default/original/2X/e/e5d5ef0d3e867d24356b31bccfeb0b0a61b8731b.png)  
image Without Chagne Rotate  
 ![WrongPixelposition](https://discourse.vtk.org/uploads/default/original/2X/9/9647c3d9ade0cf25f9ec1268dadb4a7e823733e1.png)  
Image With Rotate  
Also When I rotate Image Data Position That Changing  
Thank you if you help me
