# Slice rotation in viewport when using SetSliceToRASByNTP in python

**URL:** <https://discourse.slicer.org/t/slice-rotation-in-viewport-when-using-setslicetorasbyntp-in-python/7191>\
**Category:** Development\
**Created:** [June 16, 2019, 10:17pm UTC](https://discourse.slicer.org/t/slice-rotation-in-viewport-when-using-setslicetorasbyntp-in-python/7191 "2019-06-16T22:17:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [June 17, 2019, 4:09am UTC](https://discourse.slicer.org/t/slice-rotation-in-viewport-when-using-setslicetorasbyntp-in-python/7191/2 "2019-06-17T04:09:31Z")

</div>

Determining a smoothly changing curve normal direction is not a trivial task. In recent Slicer versions, we introduced curve node, which can provide curve tangent and normal using [Frenet-Serret frame](https://lorensen.github.io/VTKExamples/site/Cxx/Remote/FrenetSerretFrame/).

Here is a complete example of computing a panoramic X-ray from a cone-beam dental CT. Just a demonstration of how an image can be resampled along a curve - the code is not optimized for performance or quality and distance along curve is not scaled (we simply used all point indices instead of retrieving point indices based on desired distance along curve).

> <https://gist.github.com/lassoan/b445c734f118a5fb7643f3fb05f98b07>

Computed panoramic X-ray:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/7/37fbf16c15fdbd71230b7b9dcf22a6b9c85a067a.jpeg)

---

_[View the full topic](https://discourse.slicer.org/t/slice-rotation-in-viewport-when-using-setslicetorasbyntp-in-python/7191)._
