# Influence of spacing on quality

**URL:** <https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999>\
**Category:** Support\
**Created:** [December 10, 2020, 10:34pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999 "2020-12-10T22:34:05Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://discourse.slicer.org/u/Andreas)\
**Post date:** [December 10, 2020, 10:34pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/1 "2020-12-10T22:34:05Z")

</div>

Hello everyone,

I’m trying to reduce the spacing using cropped volume in order to create very thin walls with a uniform thickness, but the spacing of the cropped volume is again at 0.2826 mm. So it makes no difference whether I use cropped volume or not.  
With a required wall thickness of 0.2 mm, the spacing of ± 0.2826mm is much too high.

I can adjust the oversampling factor, but I ask myself, why wasn’t the spacing already reduced with Cropped Volume?

My main problem is the high loss of quality and that everything runs very jerkily. The program often crashes completely despite 64 GB of RAM. When I try to smooth it out with Smoothing / Median the process takes infinitely and unacceptably long.

Many thanks for your help

Yours sincerely

 ![cropped volume](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/9/99eb81bae2fa5c7d1b5e96ad4976e397bf98a887.jpeg)

![spacing still high](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/d/dd1b281b1a92f97cf5fb4fd8f2b4038f9c5fad0b.jpeg)

![oversampling](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/c/0c11ed8be14f54131533ed8b8f5d039db47fc7cf.jpeg)

 ![oversampling example](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/7/17582d096f39f52d83dbacf9ec72a9fcd4c3292e.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:** [December 11, 2020, 4:41am UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/2 "2020-12-11T04:41:46Z")

</div>

Once the segmentation geometry is established, changing the master volume does not make any difference (it was just used to determine the geometry at the beginning).

You have many options, I think I described a n previous posts already, but let’s summarize them again:

A. Not use so thin vessel walls. You cannot print a vessel with 0.2mm wall thickness, as it will crumble. Usually you either need accurate inner _or_ outer diameter, but not both, so you can use a thicker wall. Patient-specific material properties are never known, therefore there it is not a problem that you don’t reproduce the wall thickness accurately. Thin vessel walls and leaflets are commonly reproduced by painting thin silicon layer on solid parts, as current 3D printing materials are still very far from properties of real vessels and soft tissues. FEM analysis if thib structures is often more robust if you use shell elements instead of volumetric elements. So, overall, there is a very high chance ghat you don’t actually need extremely thin walls.

B. Use binary labelmap representation. Use just small enough voxels and crop the volume to minimum size. You can do the vessel segmentation at coarser resolution and oversample only for the final hollowing operation. Buy lots of RAM to keep things fast or just be patient, as all operations are slow on extremely large volumes.

C. Create hollow model in closed surface representation. You can represent arbitrarily thin walls in a surface mesh, without significant memory increase (just need about 2x more cells to have a double walls). The difficulty is of course how to make a mesh hollow. A common technique is to create an offset surface using the mesh normal. This typically generates invalid (self-intersecting) meshes, but if the wall is very thin then these errors may be negligible or relatively easily fixable

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://discourse.slicer.org/u/Andreas)\
**Post date:** [December 14, 2020, 9:45pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/3 "2020-12-14T21:45:08Z")

</div>

Hello Mr. Lasso,

I understood your explanation of point C as shown in the attached video.  
However, I do not know whether spacing was used here and whether the wall thickness is the same everywhere.

[https://dl.dropboxusercontent.com/s/v46xzcgk83bodhd/closed%20surface%20representation.mp4?dl=0](https://dl.dropboxusercontent.com/s/v46xzcgk83bodhd/closed%20surface%20representation.mp4?dl=0)

---

<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:** [December 14, 2020, 9:57pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/4 "2020-12-14T21:57:11Z")

</div>

The video above shows option B.

Option C can be implemented in a few lines of Python code using VTK filters.

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://discourse.slicer.org/u/Andreas)\
**Post date:** [December 14, 2020, 11:15pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/5 "2020-12-14T23:15:44Z")

</div>

Hello Mr. Lasso,

Thank you for putting so much effort into my questions. However, I have to admit that I do not currently have an overview of the individual processes and their specific properties / differences.

1. In the posted video I had inserted the STL file and created the wall. ---- \> Binary label map.

2. Another method I know is the Crop Volume. This reduces the size of the image.

3. From the third method, I don’t know the name, but only the symbol ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/7/877ed58f105134fcdc7452a7036135383c6c6c33.png) , which looks like a cube. With this method I can increase the oversampling factor and thus adjust the spacing.

I would like to know which of the three methods mentioned above is the best way to solve my problem.

Problem:

spacing  
even wall  
Quality of surface properties

I’m sure you have a suitable solution for me.

---

<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:** [December 15, 2020, 2:01am UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/6 "2020-12-15T02:01:34Z")

</div>

In most cases **option A or B** works best, as it is robust and allows easy editing of the shell.

If you need extremely thin walls then **option C** may be the best because option B would require too much memory and while option C is generally unreliable, it works acceptably well for thin shells. You can get a shell model of a segment as shown in this [example](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Create_a_hollow_model_from_boundary_of_solid_segment). You need to then cut off the caps, for example using “Plane cut” tool of Dynamic modeler module:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/d/ad9317a30b8a3dfb156d4bd9197b968d5b7f6b4a.jpeg)

Based on what you describe, option C seems to be the most suitable solution for your particular use case.

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://discourse.slicer.org/u/Andreas)\
**Post date:** [December 15, 2020, 3:51pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/7 "2020-12-15T15:51:04Z")

</div>

Dear Mr. Lasso,

I really like the Dynamic Modeler module for displaying the cutting planes.

I assume that by option C you mean creating a hollow model in a closed surface representation.

This option C is unfortunately not known to me.

You said it can be done with VTK filters and a few lines of phyton.

Unfortunately, I have no experience with programming languages and have not yet worked with the VTK filter.

My work now hangs only on this problem, which is why I would be very grateful for a detailed explanation.

---

<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:** [December 15, 2020, 4:20pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/8 "2020-12-15T16:20:23Z")

</div>

> [@Andreas](#):
>
> Unfortunately, I have no experience with programming languages and have not yet worked with the VTK filter.

I gave a complete solution in my post above. You just need to copy those few lines of code into the Python console and you are done.

I also created a GUI for this (as a new “Hollow” tool in Dynamic modeler), which will be available in the Slicer Preview Release tomorrow.

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://discourse.slicer.org/u/Andreas)\
**Post date:** [December 15, 2020, 5:27pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/9 "2020-12-15T17:27:38Z")

</div>

Dear Mr. Lasso,

I have inserted the codes from the above post one by one into the “Phyton Interactive”, however, nothing has changed in my segmented vessel model. I only used Scissors and Smoothing and wanted to do the Hollow with the help of the Phyton codes.

The following codes were added:

 ![Create hollow](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/8/988e8e800c3c132d3b7f50a74a22b95ef6045d7e.jpeg)

Will it be possible to use the new GUI in the stable 3D slicer version? In my work I only want to include functions that can be used in the stable version.

I also tried to reproduce their illustration/screenshot from the Dynamic modeler module with plane cut on a simplified model, unfortunately I was not able to create a cut plane.

 ![Plane cut](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/c/ac933f5b3a20174b16163929f8b9c318a0cbdad5.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:** [December 15, 2020, 8:25pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/10 "2020-12-15T20:25:26Z")

</div>

To use the code snippet, you need to replace the example node name (`Segmentation`) and segment ID (`Segment_1`) with you actual node name and segment ID.

New features are not added to stable releases, so you’ll need to use a preview release. You can pick any preview release and keep using that, thereby it can serve as your own “stable release”.

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://discourse.slicer.org/u/Andreas)\
**Post date:** [December 15, 2020, 10:10pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/11 "2020-12-15T22:10:37Z")

</div>

Hello Mr. Lasso,

In the attachment I send you a photo of the attempt to apply the Phyton code, but nothing changes. The example node name and segment ID would actually have to match the template. ( see photo)

What’s the mistake?

![shellthickness](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/1/71dfa735208624893aacf3f530e0250c6a92a542.jpeg)

![node](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/a/6a41f616e262b8942c4a15c73ca2908e0df487a3.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:** [December 15, 2020, 10:16pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/12 "2020-12-15T22:16:31Z")

</div>

It looks good except you missed the last two lines of the script.

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://discourse.slicer.org/u/Andreas)\
**Post date:** [December 15, 2020, 10:41pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/13 "2020-12-15T22:41:19Z")

</div>

I’ve added the last two lines from the script and it also forms a gold-colored vessel wall, but it still doesn’t work.

![shellthickness2](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/7/475046645055fe10685dd1e6a9610c5097a1f6df.jpeg)

 ![model](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/a/8a149867c45f7fe0318a376aae32bf4cd5116bdd.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:** [December 15, 2020, 11:15pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/14 "2020-12-15T23:15:22Z")

</div>

That’s it, that yellow model is the result. If you clip it or enable 2D visibility then you will see that it is a thin shell.

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://discourse.slicer.org/u/Andreas)\
**Post date:** [December 15, 2020, 11:47pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/15 "2020-12-15T23:47:52Z")

</div>

In the 2D visibility the shell of 3. 0mm is not shown to me. Hiding out the internal segmentation does not help either.

 ![no hollow](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/3/339148cb082561eee5b068aa6aa2f6e3b1dfbcca.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:** [December 15, 2020, 11:57pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/16 "2020-12-15T23:57:46Z")

</div>

You need to enable 2D visibility for the model (the yellow object) that you created. You can show it by right-clicking on the model node’s eye icon in Data module (and you have access to many more visibility options in the Models module).

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://discourse.slicer.org/u/Andreas)\
**Post date:** [December 16, 2020, 12:09am UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/17 "2020-12-16T00:09:52Z")

</div>

I have right-clicked on Model and clicked on Convert model to segmentation node, but I can’t cut with the scissors

 ![model segmentation](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/2/92cd7dc05d54019866c5ce57a7c56767b8aecb83.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:** [December 16, 2020, 2:04am UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/18 "2020-12-16T02:04:14Z")

</div>

Yo don’t convert this thin-shell model to segmentation node. You cannot represent this thin smooth shell as a binary labelmap. If you could, then you would have chosen option B. Instead, you need to do the conversion to shell as a very last step of the segment editing. After that, you can only edit the model, using Dynamic modeler, Surface toolbox, and other modules that operate on surface meshes. You can also edit meshes in external software, such as MeshMixer (easy to learn) or Blender (it is the 3D Slicer equivalent of 3D modeling - very powerful and very hard to learn).

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://discourse.slicer.org/u/Andreas)\
**Post date:** [December 16, 2020, 2:02pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/19 "2020-12-16T14:02:51Z")

</div>

Hello Mr. Lasso,

after I had inserted the Python codes from your script, the yellow model got. I have hidden the inside of the model and obtained the desired image in the 2-D representation. Now it’s time to cut the ends. Which module is the best way to do this? I would like to know how to save the hollow body as STL file. In the appendix I have added screenshots to my questions.

 ![model (1)](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/a/1af826c11a3815e90e0dd986759e54843a02708d.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:** [December 16, 2020, 2:39pm UTC](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/20 "2020-12-16T14:39:29Z")

</div>

Dynamic modeler - see [above](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999/6).

[Next page](https://discourse.slicer.org/t/influence-of-spacing-on-quality/14999.md?page=2)
