# How to flip the image

**URL:** <https://discourse.slicer.org/t/how-to-flip-the-image/19915>\
**Category:** Support\
**Tags:** registration, segmentation, extensions-manager, dicom, 3d-model\
**Created:** [September 29, 2021, 2:47pm UTC](https://discourse.slicer.org/t/how-to-flip-the-image/19915 "2021-09-29T14:47:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![akmal871026](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/akmal871026/32/11642_2.png) [@akmal871026](https://discourse.slicer.org/u/akmal871026)\
**Post date:** [September 29, 2021, 2:47pm UTC](https://discourse.slicer.org/t/how-to-flip-the-image/19915/1 "2021-09-29T14:47:54Z")

</div>

anyone can help how to flip the image either from right to left, or up to down?

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [September 29, 2021, 3:00pm UTC](https://discourse.slicer.org/t/how-to-flip-the-image/19915/2 "2021-09-29T15:00:08Z")

</div>

> [@akmal871026](#):
>
> flip the image

In slice views or 3D views ?

---

<div class="post-metadata">

**Author:** ![akmal871026](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/akmal871026/32/11642_2.png) [@akmal871026](https://discourse.slicer.org/u/akmal871026)\
**Post date:** [September 29, 2021, 3:06pm UTC](https://discourse.slicer.org/t/how-to-flip-the-image/19915/3 "2021-09-29T15:06:59Z")

</div>

in slicer view and also 3D viewer

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [September 29, 2021, 3:31pm UTC](https://discourse.slicer.org/t/how-to-flip-the-image/19915/4 "2021-09-29T15:31:10Z")

</div>

In 3D views, you have the orientation widget already :

![Screenshot_20210929_172743](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/7/b7d045d45edfa5f9c2c2368e86aa4cf27009a842.png)

Additionally, you can rotate a 3D view with CTRL + left click + move.

In slice views, this [module](https://github.com/chir-set/FlipViewPoint) may help.

---

<div class="post-metadata">

**Author:** ![akmal871026](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/akmal871026/32/11642_2.png) [@akmal871026](https://discourse.slicer.org/u/akmal871026)\
**Post date:** [September 29, 2021, 3:36pm UTC](https://discourse.slicer.org/t/how-to-flip-the-image/19915/5 "2021-09-29T15:36:27Z")

</div>

But, how to install in 3D Slicer

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [September 29, 2021, 4:11pm UTC](https://discourse.slicer.org/t/how-to-flip-the-image/19915/6 "2021-09-29T16:11:22Z")

</div>

> [@akmal871026](#):
>
> how to install in 3D Slicer

Like with any module that is not in the extension repository, download it from the source repository.

You may then add it using the GUI :

 ![Screenshot_20210929_180434](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/b/6b587ac3b4dd3b6ee68c92ae309aded4d9eae0f0.png)

or make a custom start script with ‘–additional-module-paths \</path/to/directory/containing/py\_file\>’.

This second method is in fact the best way to use any module.

Yes, there’s some work to do; there’s always some work to do.

🙂

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 29, 2021, 5:59pm UTC](https://discourse.slicer.org/t/how-to-flip-the-image/19915/7 "2021-09-29T17:59:55Z")

</div>

You can flip slice views using “Reformat” module: select a slice view then set the LR, PA, or IS slider value to 180. We could add flip buttons there, but in general, it is not recommended to flip slice views, as using non-standard view orientations could lead to misinterpretation of the images.

If you always want Slicer to use “patient right is screen right” slice orientation convention instead of the default (and most widely used) “patient right is screen left”, then you can modify that in menu: Edit / Application settings / Views / Slice viewer defaults.

If you want to flip the image because the imaging technologist did not set the patient orientation correctly (e.g., image was acquired HFP, but the technologist forgot to switch from the default HFS patient orientation) then you must not change the slice views but instead apply a transform to the volume and rotate the volume to the correct orientation. Note that this is a rotation - it should never be necessary to flip (mirror) a 3D volume, except very few special cases (for example, create a mirrored image of the healthy side of the face to be used as a template for reconstructing the damaged other side).

@akmal871026 Which one is your case? Why do you need to flip the images?

---

<div class="post-metadata">

**Author:** ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://discourse.slicer.org/u/Stuart)\
**Post date:** [May 19, 2024, 8:16pm UTC](https://discourse.slicer.org/t/how-to-flip-the-image/19915/8 "2024-05-19T20:16:22Z")

</div>

Hi Andras,

I segmented a file and just learned that there was an orientation problem when the material was originally scanned so I would indeed like to flip (mirror) the resulting 3D volume. Is there a way to do this?

Thanks.

---

<div class="post-metadata">

**Author:** ![pearsonm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pearsonm/32/18514_2.png) [@pearsonm](https://discourse.slicer.org/u/pearsonm)\
**Post date:** [May 20, 2024, 12:13am UTC](https://discourse.slicer.org/t/how-to-flip-the-image/19915/9 "2024-05-20T00:13:54Z")

</div>

This python snippet will flip the dataset. The index can be 0, 1 or 2 depending on the way you want to flip. I use this code to flip nuclear medicine data that is acquired on 180 degree opposed heads. The display must be refreshed to see the change.

```auto
def flipNode(node, index):
    import numpy
    from vtk.util.numpy_support import vtk_to_numpy, numpy_to_vtk
    imageData = node.GetImageData()
    nshape = tuple(reversed(imageData.GetDimensions()))
    narray = None
    narray = vtk_to_numpy(imageData.GetPointData().GetScalars()).reshape(nshape)
    print(narray.shape)
    imgdata = numpy.flip(narray, index)
    varr = numpy_to_vtk(imgdata.ravel())
    imageData.GetPointData().SetScalars(varr)

import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
mrHead = sampleDataLogic.downloadMRHead()
volumeNode = slicer.mrmlScene.GetFirstNodeByClass('vtkMRMLScalarVolumeNode')
flipNode(volumeNode, 0)

```

Mark

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 22, 2024, 1:55pm UTC](https://discourse.slicer.org/t/how-to-flip-the-image/19915/10 "2024-05-22T13:55:15Z")

</div>

A post was split to a new topic: [Flip image around an axis](https://discourse.slicer.org/t/flip-image-around-an-axis/36326)
