# Obtain single-voxel surface/shell of a segmentation

**URL:** <https://discourse.slicer.org/t/obtain-single-voxel-surface-shell-of-a-segmentation/34411>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [February 19, 2024, 9:15pm UTC](https://discourse.slicer.org/t/obtain-single-voxel-surface-shell-of-a-segmentation/34411 "2024-02-19T21:15:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Young\_Wang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/young_wang/32/13926_2.png) [@Young\_Wang](https://discourse.slicer.org/u/Young_Wang)\
**Post date:** [February 19, 2024, 9:15pm UTC](https://discourse.slicer.org/t/obtain-single-voxel-surface-shell-of-a-segmentation/34411/1 "2024-02-19T21:15:37Z")

</div>

Hi, I’m currently working on an image segmentation project where my objective is to extract only the outermost points (single-voxel surface) from a given segmentation. The ideal outcome is to achieve a shell or contour that resembles the segmentation but without any slice fill.

 ![slice fill off](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/4/a40ad0c8c901eb32f9f9771b20881a828dff8a01.jpeg)

So far, I’ve experimented with two different approaches:

**Approach One** : This involved obtaining the segmentation through intensity thresholding, followed by a hollow operation. However, I haven’t specified the tools or parameters used here, which might be crucial for understanding the process and its pitfalls.

 ![hallow](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/7/67ce0b7bccf1a2d62bd295e84e66e7577e13133a.jpeg)  
**Approach Two** : In this method, I again started with intensity thresholding, but this time followed it with Surface Wrap Solidify. I experimented with various parameters, but the results were not as successful as I had hoped. It would be beneficial to detail the specific parameters and the software used, as well as the issues encountered with this approach.  
 ![Solidify](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/c/9cf83d2b0100605f90521a77b36040c993ad11d1.jpeg)

I’m seeking advice or suggestions on how to improve these methods or alternative techniques that could help in accurately extracting the most exterior points of a segmentation. Any insights or recommendations would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [February 20, 2024, 12:30am UTC](https://discourse.slicer.org/t/obtain-single-voxel-surface-shell-of-a-segmentation/34411/2 "2024-02-20T00:30:29Z")

</div>

WrapSurfaceSolidy shell option would work well for this. After your threshold, run some dilation/erosion and closing operations to fill the interior. Then you should be able extract a single voxel thick shell with WrapSurfaceSolidify

---

<div class="post-metadata">

**Author:** ![Young\_Wang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/young_wang/32/13926_2.png) [@Young\_Wang](https://discourse.slicer.org/u/Young_Wang)\
**Post date:** [February 20, 2024, 2:41pm UTC](https://discourse.slicer.org/t/obtain-single-voxel-surface-shell-of-a-segmentation/34411/3 "2024-02-20T14:41:24Z")

</div>

@muratmaga . Thank you for your suggestion regarding the use of WrapSurfaceSolidify. I implemented this approach, but encountered unexpected results in the segmentation process. As illustrated in Figure 3, the segmentation is characterized by unusual yellow contour lines. This outcome differs significantly from the anticipated results. I would appreciate any insights or recommendations you might have to address this issue.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [February 20, 2024, 3:56pm UTC](https://discourse.slicer.org/t/obtain-single-voxel-surface-shell-of-a-segmentation/34411/4 "2024-02-20T15:56:36Z")

</div>

One problem is your structure of interest is touching the boundaries of your image. So operations like dilation, closing etc that WrapSurfaceSolidfy also relies on is failing (they have no place to grow the label).

Pad your image (you can use cropvolume for that), and try what i suggested

---

<div class="post-metadata">

**Author:** ![Young\_Wang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/young_wang/32/13926_2.png) [@Young\_Wang](https://discourse.slicer.org/u/Young_Wang)\
**Post date:** [February 20, 2024, 4:08pm UTC](https://discourse.slicer.org/t/obtain-single-voxel-surface-shell-of-a-segmentation/34411/5 "2024-02-20T16:08:23Z")

</div>

@muratmaga Thank you again for that. I’ll give it a try. On a related note, I’m curious about the possibility of cropping the segmentation to a specific region of interest (ROI). One problem I encountered during image registration is this: I need a larger ROI for initial registration to better understand the surrounding anatomical structures. However, when it comes to segmentation and subsequently quantifying the results, I want to zoom in or crop the segmentation. This is to avoid an almost perfect Hausdorff distance resulting from a large portion of similar points from the surrounding anatomical structures. I came across a few posts made by others and saw one of your suggestions. I tried specifying the region of interest after performing segmentation, but it alters the resolution of my segmentation. Any advice would be appreciated.
