# How do i smooth the shape of a structure?

**URL:** <https://discourse.slicer.org/t/how-do-i-smooth-the-shape-of-a-structure/2877>\
**Category:** Support\
**Tags:** slicerrt\
**Created:** [May 22, 2018, 3:23pm UTC](https://discourse.slicer.org/t/how-do-i-smooth-the-shape-of-a-structure/2877 "2018-05-22T15:23:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jana.az](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@Jana.az](https://discourse.slicer.org/u/Jana.az)\
**Post date:** [May 22, 2018, 3:23pm UTC](https://discourse.slicer.org/t/how-do-i-smooth-the-shape-of-a-structure/2877/1 "2018-05-22T15:23:17Z")

</div>

How do i smooth the shape of a structure? I have imported a sphere from brainlab iplan rt to 3D slicer so i can calculate the surface area. But for a specific radius, in 3D slicer the surface area is bigger than the theoretical calculation of a surface area using the formula 4_pi_r^2. It is because the sphere imported is not a perfect sphere. So how do i smooth the surface?

---

<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, 2018, 6:14pm UTC](https://discourse.slicer.org/t/how-do-i-smooth-the-shape-of-a-structure/2877/2 "2018-05-22T18:14:33Z")

</div>

Have you imported the sphere from DICOM RT structure set?  
How have you computed the surface area?  
How large is the error relative to the total volume?  
Can you attach a screenshot?

---

<div class="post-metadata">

**Author:** ![Jana.az](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@Jana.az](https://discourse.slicer.org/u/Jana.az)\
**Post date:** [May 23, 2018, 9:15am UTC](https://discourse.slicer.org/t/how-do-i-smooth-the-shape-of-a-structure/2877/3 "2018-05-23T09:15:28Z")

</div>

The sphere is imported from DICOM RT structure.  
The surface area is computed when i did segmentation and exported the structure to models, i went to the models’ module and clicked on the information. The volume had a difference of 0.3 cm^3 from the theoretical and the one computed in iplan RT, which we can say is acceptable.  
However, the surface area had a difference of 10 cm^2 because as i said the sphere is not a perfect sphere, i’ll attach a screenshot of the sphere

 ![Untitled](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/e/de97aadc74e7fcae81f88ad0b596ee2475cc3a51.jpeg)

So i need a method to transform this sphere to a circular form and not small adjacent segments like in the photo, because this is I guess why the surface area is different.

---

<div class="post-metadata">

**Author:** ![Jana.az](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@Jana.az](https://discourse.slicer.org/u/Jana.az)\
**Post date:** [May 23, 2018, 9:21am UTC](https://discourse.slicer.org/t/how-do-i-smooth-the-shape-of-a-structure/2877/4 "2018-05-23T09:21:36Z")

</div>

This is a screenshot of the difference of calculations, this sphere is imported from iplan rt

 ![Untitled2](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/0/40e68f86d9b855ece3db224b113539a839ab39c1.jpeg)

---

<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 23, 2018, 4:05pm UTC](https://discourse.slicer.org/t/how-do-i-smooth-the-shape-of-a-structure/2877/5 "2018-05-23T16:05:51Z")

</div>

I’ve done a quick test and the surface computation in Slicer seems to be accurate - well below 1%.

- download a sample head MRI data set
- create sphere shaped segment of 20mm radius
- compute surface and volume =\> Surface area: 5024.96 (error: -0.03%), Volume: 33489.18 (error: -0.06%)
- rasterize it with on a volume’s voxel grid
- compute surface and volume =\> Surface area: 5042.75 (error: 0.32%), Volume: 33631.30 (error: 0.36%)

You can find the script here: [This example shows how to compute volume and surface area of a segment in 3D Slicer · GitHub](https://gist.github.com/lassoan/179776ffaaa57f4958906596f890fc67)  
You can click on “Raw” view and copy-paste the code into Slicer’s Python console.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/2/921318e78784c8a8990b602d54ab043a4b36ad89.png)

Try using Segment Statistics module to compute surface, volume, and other segment properties. It uses the same algorithms as the models module, but Segment Statistics does everything directly on the segmentation node (less chance to mess things up by performing manual steps) and computes properties for both closed surface and labelmap representations.

You may adjust smoothing factor of the closed surface representation (in Segmentations module: Representations / Close surface / Update / Binary labelmap → Closed surface / Smoothing factor) to make the surface smoother, but the default setting should work well.

If you still have problems, then upload the RTSTRUCT DICOM file somewhere and post the link here so that we can investigate.

---

<div class="post-metadata">

**Author:** ![Jana.az](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@Jana.az](https://discourse.slicer.org/u/Jana.az)\
**Post date:** [May 27, 2018, 9:43am UTC](https://discourse.slicer.org/t/how-do-i-smooth-the-shape-of-a-structure/2877/6 "2018-05-27T09:43:03Z")

</div>

The sphere created inside the 3d slicer compute the volume and surface area correctly. But i’m talking about the sphere created in iplan RT and imported to a dicom RT structure and opened in 3d Slicer. Here i found the screenshots uploaded above, and the big difference in surface area.

Regarding the Segment statistics modle, when i try to update from binary labelmap so i can use the smoothing factor on my RT structure sphere, the software crashes and i can’t do anything until i close it and open it again. So i can’t use the effects of Segment editor module on my dicom RT Structure.

---

<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 27, 2018, 1:09pm UTC](https://discourse.slicer.org/t/how-do-i-smooth-the-shape-of-a-structure/2877/7 "2018-05-27T13:09:51Z")

</div>

These should never happen and most likely there is just caused by some trivial issue that is easy to fix.

Could you share the DICOM RTSTRUCT and image file (upload to Dropbox/OneDrive/Google drive and copy the link here)?

> [@Jana.az](#):
>
> when i try to update from binary labelmap so i can use the smoothing factor on my RT structure sphere, the software crashes

Could you send the application log? After you restart Slicer, select in menu: Help / Report a bug, and select the previous session in the listbox, then copy the text. If the text is long then upload somewhere and copy the link here.

By the way, BrainLab can also export segmentation as DICOM segmentation object, which is a more exact representation of segmentation than the legacy RTSTRUCT object. @fedorov, @pieper do you know how to export DICOM segment object from BrainLab?

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [May 28, 2018, 1:40pm UTC](https://discourse.slicer.org/t/how-do-i-smooth-the-shape-of-a-structure/2877/8 "2018-05-28T13:40:57Z")

</div>

> [@lassoan](#):
>
> @fedorov, @pieper do you know how to export DICOM segment object from BrainLab?

@lassoan I personally never used Brainlab, and I don’t have access to a system to try it myself, so I can’t answer that question. But if @Jana.az could let me know the name of the specific product (Brainlab has different products) and the version, I can ask someone at Brainlab who might be able to help.
