# FlipImageFilter (in ITK Simple filters) broken?

**URL:** <https://discourse.slicer.org/t/flipimagefilter-in-itk-simple-filters-broken/34612>\
**Category:** Support\
**Created:** [February 29, 2024, 10:26am UTC](https://discourse.slicer.org/t/flipimagefilter-in-itk-simple-filters-broken/34612 "2024-02-29T10:26:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shai-ikko](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shai-ikko/32/15765_2.png) [@shai-ikko](https://discourse.slicer.org/u/shai-ikko)\
**Post date:** [February 29, 2024, 10:26am UTC](https://discourse.slicer.org/t/flipimagefilter-in-itk-simple-filters-broken/34612/1 "2024-02-29T10:26:06Z")

</div>

Hi,

I have a volume which I want to flip along one of the axes, and I was very happy to find the FlipImageFilter in the list of Simple Filters. However, when I apply the filter, I don’t get the expected results.

The end result looks like nothing happened; If I’m lucky and observant enough, sometimes I can see the displayed volume flip and then flip back. When I examine the original vs. the filtered image, I can see that the content of the volume was indeed flipped – as can be evidenced by the relationship between space coordinates and grid coordinates – but the directions matrix is also changed (relevant value negated), and the total result is that the represented volume is exactly identical to the original.

Is this the intended effect?

Slicer 5.4.0 on Linux.

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/b/1be1851009f63a8641fb2c78d011d2655a558baf.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/3/b3d336132869531549964ece4cc085c2012e5934.png)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 29, 2024, 2:18pm UTC](https://discourse.slicer.org/t/flipimagefilter-in-itk-simple-filters-broken/34612/2 "2024-02-29T14:18:39Z")

</div>

Flipping the image contents changes their memory layout but not the physical location. You can use a transform to change the physical location of the pixels (e.g. negate a column to flip).

---

<div class="post-metadata">

**Author:** ![shai-ikko](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shai-ikko/32/15765_2.png) [@shai-ikko](https://discourse.slicer.org/u/shai-ikko)\
**Post date:** [February 29, 2024, 3:32pm UTC](https://discourse.slicer.org/t/flipimagefilter-in-itk-simple-filters-broken/34612/3 "2024-02-29T15:32:06Z")

</div>

Yes, that’s what I described – but it’s a bit surprising after looking at things like [https://examples.itk.org/src/filtering/imagegrid/flipanimageoverspecifiedaxes/documentation](https://examples.itk.org/src/filtering/imagegrid/flipanimageoverspecifiedaxes/documentation)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 29, 2024, 3:37pm UTC](https://discourse.slicer.org/t/flipimagefilter-in-itk-simple-filters-broken/34612/4 "2024-02-29T15:37:27Z")

</div>

Probably the ITK example code doesn’t take into account the index to physical mapping. ITK originally didn’t include orientation in the images so some of the code and examples don’t include it.
