# Dilation erosion element type

**URL:** <https://discourse.slicer.org/t/dilation-erosion-element-type/23722>\
**Category:** Feature requests\
**Tags:** segmentation\
**Created:** [June 6, 2022, 5:43am UTC](https://discourse.slicer.org/t/dilation-erosion-element-type/23722 "2022-06-06T05:43:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![massisenergy](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@massisenergy](https://discourse.slicer.org/u/massisenergy)\
**Post date:** [June 6, 2022, 5:43am UTC](https://discourse.slicer.org/t/dilation-erosion-element-type/23722/1 "2022-06-06T05:43:25Z")

</div>

Dear,

Does 3DSlicer offer any more element types (sphere, circle, rectangle etc.) than squared pixels?

For example, I have a tomography image which is high resolution (very small pixel size). That, upon surface-export, results in a jagged isosurface with very large number of triangles which I do not need.

 ![StepsProducedForSphericalSurface](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/e/1ec935df3d423f07cc7af969660913b30d7989c1.jpeg)

If I could use a sphere or ball as my dilation-erosion element of chosen size, I could get a lot smoother, non-pixelated (and less number of triangle) surface for my use case.

Any information / advice on this will be highly appreciated.

With regards,  
massisenergy

---

<div class="post-metadata">

**Author:** ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)\
**Post date:** [June 6, 2022, 8:15am UTC](https://discourse.slicer.org/t/dilation-erosion-element-type/23722/2 "2022-06-06T08:15:28Z")

</div>

You can get reducing the numer of triangles by using decimation on your mesh… If I were you I would set it to 6% and see how it gets

---

<div class="post-metadata">

**Author:** ![massisenergy](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@massisenergy](https://discourse.slicer.org/u/massisenergy)\
**Post date:** [June 6, 2022, 4:52pm UTC](https://discourse.slicer.org/t/dilation-erosion-element-type/23722/3 "2022-06-06T16:52:26Z")

</div>

Hello,

Thanks for your suggestion. Unfortunately ‘Decimate’ doesn’t work for my use case. It couldn’t remove the jagged edges, rather resulted in bad quality triangles.

 ![ScreenShot 2022-06-06 at 9.24.48 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/8/2826efa4bd7f62d8d5c04ae04c88aaab0968ebe2.jpeg)

Then I tried using the `Surface Models` \> `Advanced` \> `Smoothing`. After playing with the parameters (Iterations: 100, Relaxation: 0.1) , I could reduce the jagging a lot **but not without a ~15% decrease in the overall volume**!

 ![ScreenShot 2022-06-06 at 10.17.17 PM Large](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/a/2a6b5fc295d4b5b6b7a40e1c9e40d4b50c75ee44.jpeg)

 ![ScreenShot 2022-06-06 at 9.24.22 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/8/0809c3a451b50c5f8477525a791be16f2440ef9e.jpeg)

Any other ideas, folks?

---

<div class="post-metadata">

**Author:** ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)\
**Post date:** [June 6, 2022, 5:31pm UTC](https://discourse.slicer.org/t/dilation-erosion-element-type/23722/4 "2022-06-06T17:31:16Z")

</div>

Maybe you can try some kind of lapalacian smoothing filter for polydata and then decimate  
Maybw try with rhe taubin one.

Hopw it helps

---

<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:** [June 6, 2022, 6:43pm UTC](https://discourse.slicer.org/t/dilation-erosion-element-type/23722/5 "2022-06-06T18:43:58Z")

</div>

It looks like your input data was pixelated (binarized) before the original surface was generated. Starting with an original continuous tone scan would be the normal way to generate a smooth isosurface.

---

<div class="post-metadata">

**Author:** ![massisenergy](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@massisenergy](https://discourse.slicer.org/u/massisenergy)\
**Post date:** [June 7, 2022, 3:48pm UTC](https://discourse.slicer.org/t/dilation-erosion-element-type/23722/6 "2022-06-07T15:48:57Z")

</div>

@mau_igna_06 Okay. Reducing the total number of triangles isn’t hard anymore, `Blender (v 3.1.2)` serves the purpose quite well. I tried with the `Taubin` option as well, that also removes volume while smoothing!

@pieper exactly. I got a binary pixelated tomography data and I have make smooth surface out of it. You’re absolutely in the right direction:

> [@pieper](#):
>
> Starting with an original continuous tone scan would be the normal way to generate a smooth isosurface.

I realise that even if Slicer offers sphere type (which is not available at the moment I guess?) dilation or erosion elements, _simply_ working with those on **square pixelated** tomography data would inevitably result in the loss of some volume 😁.

So my question now changes into – _Is it possible to get smooth surface out of binary pixelated data (negligible loss of volume)?_

---

<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:** [June 7, 2022, 5:07pm UTC](https://discourse.slicer.org/t/dilation-erosion-element-type/23722/7 "2022-06-07T17:07:58Z")

</div>

If the mesh-based smoothing is failing (which make some sense given that the data is basically aliased) then converting the mesh to an image, smoothing in image space, and re-isosurfacing may work better. You will have options about kernel size, weights, and thresholds so you can see what works best for that data.

---

<div class="post-metadata">

**Author:** ![massisenergy](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@massisenergy](https://discourse.slicer.org/u/massisenergy)\
**Post date:** [August 17, 2022, 10:57am UTC](https://discourse.slicer.org/t/dilation-erosion-element-type/23722/8 "2022-08-17T10:57:31Z")

</div>

Thanks all. For now, I used the Blender provided smoothing tools, but generating the surface without any “voxelized segmentation” would be best if smoothing induced volume loss is unacceptable!

---

<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:** [March 21, 2023, 2:13am UTC](https://discourse.slicer.org/t/dilation-erosion-element-type/23722/9 "2023-03-21T02:13:04Z")

</div>


