# Rotating a implicit function called vtkCylinder

**URL:** <https://discourse.slicer.org/t/rotating-a-implicit-function-called-vtkcylinder/13323>\
**Category:** Development\
**Created:** [September 3, 2020, 3:07pm UTC](https://discourse.slicer.org/t/rotating-a-implicit-function-called-vtkcylinder/13323 "2020-09-03T15:07:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 3, 2020, 3:07pm UTC](https://discourse.slicer.org/t/rotating-a-implicit-function-called-vtkcylinder/13323/1 "2020-09-03T15:07:51Z")

</div>

Hello everyone,  
I am new to VTK and this forum. I just wanted to know if there is a solution to rotate an implicit function called vtkCylinder by 90 degrees. I would like to add the clip functionality in ModelClip extension and set it to the vtkCylinder implicit function. With vtkCylinderSource.h I have read that it is possible by translating the center and rotating by 90 degrees and translating back. Is there similar solution to achieve it?

---

<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 3, 2020, 4:25pm UTC](https://discourse.slicer.org/t/rotating-a-implicit-function-called-vtkcylinder/13323/2 "2020-09-03T16:25:36Z")

</div>

You can transform nodes by applying a transformation node as shown here:

[![](https://img.youtube.com/vi/bbikx7Edv4g/hqdefault.jpg "Transforming objects using Data module in 3D Slicer") ](https://www.youtube.com/watch?v=bbikx7Edv4g)

If you want to use this from a Python script then check out these examples: [https://www.slicer.org/wiki/Documentation/Nightly/Modules/Transforms#Examples](https://www.slicer.org/wiki/Documentation/Nightly/Modules/Transforms#Examples)

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 4, 2020, 2:53pm UTC](https://discourse.slicer.org/t/rotating-a-implicit-function-called-vtkcylinder/13323/3 "2020-09-04T14:53:21Z")

</div>

Thank you for your reply! But what I am trying to rotate the implicit function with header name vtkCylinder.h by 90 degrees. I already have assigned the center and the radius of the cylinder but I am editing a loadable module. I would like to clip a stl data in two parts around the center with this cylinder function. But I would have to rotate the cylinder by 90 degrees to get the clipping functionality right.

---

<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 4, 2020, 4:19pm UTC](https://discourse.slicer.org/t/rotating-a-implicit-function-called-vtkcylinder/13323/4 "2020-09-04T16:19:34Z")

</div>

You can change orientation of a vtkCylinder implicit function by calling its `SetAxis` method.

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 8, 2020, 8:07pm UTC](https://discourse.slicer.org/t/rotating-a-implicit-function-called-vtkcylinder/13323/5 "2020-09-08T20:07:41Z")

</div>

Hey Andras,  
Thank you very much! I did as you suggested and now it works. I would like to ask one more thing. I have clipped the stl data successfully. But now I am trying to rotate those clipped parts(one of them would be fine). It’d be really nice if you could give me some suggestions regarding it.

---

<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 8, 2020, 10:25pm UTC](https://discourse.slicer.org/t/rotating-a-implicit-function-called-vtkcylinder/13323/6 "2020-09-08T22:25:26Z")

</div>

You can apply transform to the segmentation node. If you want to rotate individual segments but not others, then you can:

- move the segments to a new segmentation node
- apply a transform to the new segmentation node
- move the segments back to the original segmentation node

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 10, 2020, 11:26am UTC](https://discourse.slicer.org/t/rotating-a-implicit-function-called-vtkcylinder/13323/7 "2020-09-10T11:26:54Z")

</div>

Thank you will try and let you know!

---

<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 10, 2020, 1:28pm UTC](https://discourse.slicer.org/t/rotating-a-implicit-function-called-vtkcylinder/13323/8 "2020-09-10T13:28:23Z")

</div>

A post was merged into an existing topic: [Cannot find rectangle segmentation option](https://discourse.slicer.org/t/cannot-find-rectangle-segmentation-option/13286/20)
