# How can I Rotate VTKImageSlice ?

**URL:** https://discourse.vtk.org/t/how-can-i-rotate-vtkimageslice/10689
**Category:** Development
**Tags:** doxygen, code, proposal
**Created:** [February 15, 2023, 7:55am UTC](https://discourse.vtk.org/t/how-can-i-rotate-vtkimageslice/10689 "2023-02-15T07:55:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![A.M\_Shahpouri](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a.m_shahpouri/32/6549_2.png) [@A.M\_Shahpouri](https://discourse.vtk.org/u/A.M_Shahpouri)
#### Post date: [February 15, 2023, 7:55am UTC](https://discourse.vtk.org/t/how-can-i-rotate-vtkimageslice/10689/1 "2023-02-15T07:55:10Z")

</div>

Hi

I have problem in Reslicing With vtkPlane

I want to reslice in 4 axes-\>(Axial , Sagittal , Coronal , oblique ) with vtkPlane , so I use vtkImageReliceMapper and set Plane for each one . Then I make vtkImageSlice and set ImgeResliceMapper in it’s Mapper. So now I Have 4 prop and I can add these to Renderer But there is a problem . In Sagittal , Coronal , oblique axes the image Is not Front of Camera. so We should Rotate props(vtkImageSlice) but if we use ImageSlice-\>RotateX()(or Y or Z) or ImageSlice-\>RotateWXYZ() the plane of Reslicing will rotate and make Wrong picture.

> > So How Can I Rotate vtkImageSlice in such a way that don’t effect on resliceplane(normal of reslice) ?  
> > (I can not change View of Camera and can not use vtkReliceImage In my project )

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [February 15, 2023, 2:23pm UTC](https://discourse.vtk.org/t/how-can-i-rotate-vtkimageslice/10689/2 "2023-02-15T14:23:15Z")

</div>

The correct approach is to set the camera, so that the camera view matches the slice orientation.

For an example, see [TestImageResliceMapperOrient3D](https://gitlab.kitware.com/vtk/vtk/-/blob/master/Rendering/Image/Testing/Cxx/TestImageResliceMapperOrient3D.cxx). Also look at the methods provided by [vtkImageMapper3D](https://vtk.org/doc/nightly/html/classvtkImageMapper3D.html) (this is the superclass of vtkImageResliceMapper).

![TestImageResliceMapperOrient3D](https://discourse.vtk.org/uploads/default/original/2X/a/ad0154544f858b30b202da29390224c13ce8dce5.png)

---

<div class="post-metadata">

### Author: ![A.M\_Shahpouri](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a.m_shahpouri/32/6549_2.png) [@A.M\_Shahpouri](https://discourse.vtk.org/u/A.M_Shahpouri)
#### Post date: [March 27, 2023, 1:01pm UTC](https://discourse.vtk.org/t/how-can-i-rotate-vtkimageslice/10689/3 "2023-03-27T13:01:48Z")

</div>

thank you so much David
