# Flipped normals during linear transform of model

**URL:** <https://discourse.slicer.org/t/flipped-normals-during-linear-transform-of-model/4911>\
**Category:** Support\
**Tags:** transforms, 3d-model\
**Created:** [November 29, 2018, 3:36pm UTC](https://discourse.slicer.org/t/flipped-normals-during-linear-transform-of-model/4911 "2018-11-29T15:36:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dominicwhite](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dominicwhite/32/2364_2.png) [@dominicwhite](https://discourse.slicer.org/u/dominicwhite)\
**Post date:** [November 29, 2018, 3:36pm UTC](https://discourse.slicer.org/t/flipped-normals-during-linear-transform-of-model/4911/1 "2018-11-29T15:36:05Z")

</div>

I’m importing a 3d model created in another program and trying to align it with the same model created in Slicer, and I’m running into a problem with the normals of the model.

Here’s the model after import:

 ![01%20AM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/f/4f15acfe592ab55e04e3fae63576b6cc0ebd6867.jpeg)

And here’s the same model after a reflection using the Transforms module:

 ![47%20AM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/b/3b7011fcc3c009a13e567a143ca2c442cfefd52c.jpeg)

This appears to be a problem with the normals - I can reverse it with Surface Toolbox’s flipped normals.

However, is there a way to do a reflection which doesn’t flip the normals?

Here are my Linear Transform settings to reproduce this effect:

 ![55%20AM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/3/33bf96ee4e0fbaaba9ee5d01a5ebc501037204cf.png)

---

<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:** [November 29, 2018, 4:07pm UTC](https://discourse.slicer.org/t/flipped-normals-during-linear-transform-of-model/4911/2 "2018-11-29T16:07:24Z")

</div>

> [@dominicwhite](#):
>
> However, is there a way to do a reflection which doesn’t flip the normals?

If you turn the model inside out (apply a linear transform with a matrix that has negative determinant) then the surface normals will be reversed, too. Using Surface Toolbox module is a good solution. Is there any specific reason you would only want to turn the surface inside out but not flip the normals?

---

<div class="post-metadata">

**Author:** ![dominicwhite](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dominicwhite/32/2364_2.png) [@dominicwhite](https://discourse.slicer.org/u/dominicwhite)\
**Post date:** [November 29, 2018, 4:53pm UTC](https://discourse.slicer.org/t/flipped-normals-during-linear-transform-of-model/4911/3 "2018-11-29T16:53:46Z")

</div>

Andras

My linear algebra is pretty rusty, so I may be missing something here, but I’m not trying to turn the model inside out.

What I want to do is flip the model around one of the axes (i.e. map every x coordinate to -x, while keeping y & z coordinates the same).

I was following the instructions in the Wiki FAQ for this question: [https://www.slicer.org/wiki/Documentation/4.10/FAQ#How\_do\_I\_fix\_incorrect\_axis\_directions.3F\_Can\_I\_flip\_an\_image\_.28left.2Fright.2C\_anterior.2Fposterior\_etc.29\_.3F](https://www.slicer.org/wiki/Documentation/4.10/FAQ#How_do_I_fix_incorrect_axis_directions.3F_Can_I_flip_an_image_.28left.2Fright.2C_anterior.2Fposterior_etc.29_.3F)

It just seems counter-intuitive to me that reflecting the model through a plane would also flip the normals (but see above re: math & rusty). Hence my original question, is there a Transform matrix to do a reflection without also flipping the normals?

---

<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:** [November 29, 2018, 8:09pm UTC](https://discourse.slicer.org/t/flipped-normals-during-linear-transform-of-model/4911/4 "2018-11-29T20:09:36Z")

</div>

> [@dominicwhite](#):
>
> Hence my original question, is there a Transform matrix to do a reflection without also flipping the normals?

There is not. Inverting direction of axis turns the model inside out (the inside surface of the non-transformed model becomes outside surface in the transformed model).

---

<div class="post-metadata">

**Author:** ![steffen-o](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/steffen-o/32/2660_2.png) [@steffen-o](https://discourse.slicer.org/u/steffen-o)\
**Post date:** [December 3, 2018, 9:01am UTC](https://discourse.slicer.org/t/flipped-normals-during-linear-transform-of-model/4911/5 "2018-12-03T09:01:07Z")

</div>

You could do the flipping in [Meshlab](http://www.meshlab.net/) (it’s also free) before you import it into Slicer.  
There you can flip the axis (Filters-\>Normals Curvature Orientation -\>Transform, flip swap axis) and invert the faces orientation (Filters-\>Normals Curvature Orientation -\> Invert faces orientation).

---

<div class="post-metadata">

**Author:** ![dominicwhite](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dominicwhite/32/2364_2.png) [@dominicwhite](https://discourse.slicer.org/u/dominicwhite)\
**Post date:** [December 6, 2018, 4:41pm UTC](https://discourse.slicer.org/t/flipped-normals-during-linear-transform-of-model/4911/6 "2018-12-06T16:41:28Z")

</div>

Thanks, @steffen-o . I’m trying to build a script to import files from another program into Slicer, so I’d prefer to do it all “in-house”.

In case anyone has the same problem in future, I was eventually able to flip surface models without inverting normals using the “Surface Toolbox” module’s Mirror operation.

---

<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:** [December 7, 2018, 12:52am UTC](https://discourse.slicer.org/t/flipped-normals-during-linear-transform-of-model/4911/7 "2018-12-07T00:52:47Z")

</div>

Surface toolbox is a Python scripted module, which exposes a few VTK filters on the GUI. Of course you can use those VTK filters directly in your script.
