# Conversion of a complex structure from closed surface to binary labelmap

**URL:** <https://discourse.slicer.org/t/conversion-of-a-complex-structure-from-closed-surface-to-binary-labelmap/31803>\
**Category:** Support\
**Created:** [September 20, 2023, 2:06pm UTC](https://discourse.slicer.org/t/conversion-of-a-complex-structure-from-closed-surface-to-binary-labelmap/31803 "2023-09-20T14:06:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matteboo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/matteboo/32/66548_2.png) [@Matteboo](https://discourse.slicer.org/u/Matteboo)\
**Post date:** [September 20, 2023, 2:06pm UTC](https://discourse.slicer.org/t/conversion-of-a-complex-structure-from-closed-surface-to-binary-labelmap/31803/1 "2023-09-20T14:06:00Z")

</div>

Hello,

I import in Slicer a segmentation of bloodvessel in .stl format.  
However I want to do operation on it in slicer (use the scisor tool for example) and to do that I need to change the master represenation from “Closed surface” to “Binary LabelMap”  
It works for small segmentation but it doesn’t work for a big complex one.  
Is there any tricks to make the conversion easier for 3Dslicer ?  
Also I don’t really know why the conversion isn’t working. Slicer just stop responding as if it’s computing in the background but the calculation never finish.  
When 3Dslicer is computing, my CPU usage is 35%, my RAM usage is 63% (13,9 Go of available RAM) and my GPU is at 2% usage so I don’t think the issue is that my PC is not powerfull enought.

If anybody has any advice, that would be very helpfull

Here is a link to the file that’s causing an issue [translated\_vessels.stl - Google Drive](https://drive.google.com/file/d/1LIGiy7LulJkyYNr2xmTWkt17iqMUYRVq/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [September 20, 2023, 2:38pm UTC](https://discourse.slicer.org/t/conversion-of-a-complex-structure-from-closed-surface-to-binary-labelmap/31803/2 "2023-09-20T14:38:01Z")

</div>

Your file does load immediately on my system (5.5.0-2023-09-13 r32175, Linux). Looks like pulmonary vessels that need smoothing. It’s not a big file.

Are you perchance using Mac with M1/M2 CPU? There have been some many reports of simple tasks not performing well on that emulated OS.

---

<div class="post-metadata">

**Author:** ![Matteboo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/matteboo/32/66548_2.png) [@Matteboo](https://discourse.slicer.org/u/Matteboo)\
**Post date:** [September 20, 2023, 4:09pm UTC](https://discourse.slicer.org/t/conversion-of-a-complex-structure-from-closed-surface-to-binary-labelmap/31803/3 "2023-09-20T16:09:06Z")

</div>

The file loads easily is converting the file to a binary label time that isn’t working.  
I’m on window 10.  
I let 3DSlicer run for more than 2hours and when I got back the conversion was done.  
I guess it just takes a lot of time but I don’t know why.  
My CPU is a ryzen 7 3750H and my GPU is a RTX2060 if that can help.

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [September 20, 2023, 5:54pm UTC](https://discourse.slicer.org/t/conversion-of-a-complex-structure-from-closed-surface-to-binary-labelmap/31803/4 "2023-09-20T17:54:05Z")

</div>

I misread your post, sorry. The conversion is burning my CPU too. We’ll probably end up saying it’s big a workload.

---

<div class="post-metadata">

**Author:** ![Matteboo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/matteboo/32/66548_2.png) [@Matteboo](https://discourse.slicer.org/u/Matteboo)\
**Post date:** [September 21, 2023, 1:48pm UTC](https://discourse.slicer.org/t/conversion-of-a-complex-structure-from-closed-surface-to-binary-labelmap/31803/5 "2023-09-21T13:48:39Z")

</div>

What’s weird is that my CPU isn’t burning or anything, it’s sitting at 35% use all the way throught the conversion.  
Is there a setting that I could have activated by mistake that reduces the amount of CPU used for this operation?

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [September 22, 2023, 10:34am UTC](https://discourse.slicer.org/t/conversion-of-a-complex-structure-from-closed-surface-to-binary-labelmap/31803/6 "2023-09-22T10:34:17Z")

</div>

Unfortunately the conversion algorithms (and many other algoritms) that Slicer uses from VTK are not all well optimized, and so the majority of the computations happen on a single thread. Since Slicer is mainly a research tool, and the underlying libraries are also developed from research grants, performance optimization has not been a priority.

There is a recently published algorithm for voxelization that might speed up this specific conversion considerably. Please see here:

> <https://github.com/Slicer/Slicer/pull/7224>
>
> This aims to allow users to choose to leverage \[3D surface nets\](https://discour…se.vtk.org/t/new-isocontouring-filter-for-discrete-labled-volumetric-data-vtksurfacenets3d/10614) to generate closed surfaces from segmented structures. This filter is more performant than the currently utilized flying edges. To use surface nets, check the "Use Surface Nets" box in the "Show 3D" drop-down menu, as shown. 
> !\[image\](https://github.com/Slicer/Slicer/assets/133793250/f5148397-2158-4c0a-9584-7f53833cbcb4)
> For more information, see #7103

---

<div class="post-metadata">

**Author:** ![Matteboo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/matteboo/32/66548_2.png) [@Matteboo](https://discourse.slicer.org/u/Matteboo)\
**Post date:** [September 25, 2023, 11:25am UTC](https://discourse.slicer.org/t/conversion-of-a-complex-structure-from-closed-surface-to-binary-labelmap/31803/7 "2023-09-25T11:25:01Z")

</div>

Thanks for the explanation.

It’s good to know that a faster algorithm exists, but I think that in the near future I’ll just find other ways or launch the conversion while I’m doing something else 🙂
