# Fastest way of creating surface model?

**URL:** <https://discourse.slicer.org/t/fastest-way-of-creating-surface-model/17948>\
**Category:** Support\
**Created:** [June 4, 2021, 12:47pm UTC](https://discourse.slicer.org/t/fastest-way-of-creating-surface-model/17948 "2021-06-04T12:47:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)\
**Post date:** [June 4, 2021, 12:47pm UTC](https://discourse.slicer.org/t/fastest-way-of-creating-surface-model/17948/1 "2021-06-04T12:47:03Z")

</div>

In my slicer plugin, I need to model the bones and skin in the ROI and make a model. I used @lassoan’s [extract skin surface](https://gist.github.com/lassoan/1673b25d8e7913cbc245b4f09ed853f9) method , But the speed is a bit slow, is there a faster method? In fact, I only need the back surface, is there a faster and more effective method?

> **translated from original**
>
> 在我开发slicer插件中,需要对ROI中的骨骼和皮肤建模,做出model,我用了@lassoan 的[extract skin surface](https://gist.github.com/lassoan/1673b25d8e7913cbc245b4f09ed853f9) 的方法,可是速度有点慢,有没有更快的方法呢?其实我只需要后表面,有没有更快,更有效的方法呢?

---

<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:** [June 4, 2021, 1:41pm UTC](https://discourse.slicer.org/t/fastest-way-of-creating-surface-model/17948/2 "2021-06-04T13:41:54Z")

</div>

There are many ways to do this. What is the clinical application? How the segmentation will be used? What are your time and accuracy constraints?

---

<div class="post-metadata">

**Author:** ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)\
**Post date:** [June 4, 2021, 5:11pm UTC](https://discourse.slicer.org/t/fastest-way-of-creating-surface-model/17948/3 "2021-06-04T17:11:31Z")

</div>

I only need, for example, the back surface of the vertebral body. I want to use the [Ray Casting](https://pyscience.wordpress.com/2014/09/21/ray-casting-with-python-and-vtk-intersecting-linesrays-with-surface-meshes/) function to determine the bone entry point of pedicle puncture.

> **translated from original**
>
> 我只需要比如椎体的后表面,我想借助[Ray Casting](https://pyscience.wordpress.com/2014/09/21/ray-casting-with-python-and-vtk-intersecting-linesrays-with-surface-meshes/)函数来确定椎弓根穿刺的入骨点.

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/1/31891794fd0811656b69af144019b8e26cf7f83c.jpeg)

---

<div class="post-metadata">

**Author:** ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)\
**Post date:** [June 4, 2021, 5:20pm UTC](https://discourse.slicer.org/t/fastest-way-of-creating-surface-model/17948/4 "2021-06-04T17:20:37Z")

</div>

I used the method of reducing the volume, and it seems to be effective… Is there a better way? For example, is there a way to make a model in a cylinder?

> **translated from original**
>
> 我用了缩小体积的方法,似乎有效…是不是还有更好的方法呢?比如有没有一个方法,在一个圆柱里里面建模呢?

---

<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:** [June 4, 2021, 11:47pm UTC](https://discourse.slicer.org/t/fastest-way-of-creating-surface-model/17948/5 "2021-06-04T23:47:17Z")

</div>

If you need intersection point of a line and a surface mesh then you can [IntersectWithLine](https://vtk.org/doc/nightly/html/classvtkCellLocator.html#a18c5f9154bc37cdb9654c55050c25da3) method of cell locators.

To get intersection of a line with a volume, you can compute a line profile (probe the image with a line) using “Line Profile” module in Sandbox extension; or you can implement yourself using vtkProbeFilter. You can then find the intersection point by finding the point where the voxel value goes above a chosen threshold value.

I would recommend to use/extend/customize the [PedicleScrewSimulator](https://github.com/lassoan/PedicleScrewSimulator) extension.

---

<div class="post-metadata">

**Author:** ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)\
**Post date:** [June 5, 2021, 11:21am UTC](https://discourse.slicer.org/t/fastest-way-of-creating-surface-model/17948/6 "2021-06-05T11:21:45Z")

</div>

> [@lassoan](#):
>
> vtkProbeFilter

Perfect solution, thank you teacher! ! Use vtkProbeFilter

> **translated from original**
>
> 完美解决,谢谢老师!!用vtkProbeFilter
