# Cutting vessels - CFD

**URL:** <https://discourse.slicer.org/t/cutting-vessels-cfd/35165>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [March 29, 2024, 2:01pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165 "2024-03-29T14:01:10Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Killmaro](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/killmaro/32/77864_2.png) [@Killmaro](https://discourse.slicer.org/u/Killmaro)\
**Post date:** [March 29, 2024, 2:01pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/1 "2024-03-29T14:01:10Z")

</div>

Hi

I’m working on pulmonary vessels CFD. After extracting the centerlines of my vascular tree, I’m aiming to automatically trim vessel ends below a certain caliber, perpendicular to the centerlines. I attempted to use the “vesselness filtering” tool in the VMTK module, but it doesn’t recognize the volume of my tree (STL file directly imported into Slicer). Is there a way to achieve this ?

Thank you in advance for your help

 ![Capture d’écran 2024-03-29 à 14.40.19](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/4/b4f3ad8c9a99e4c6786bafb31912d88cb22ee44d.jpeg)

---

<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:** [March 30, 2024, 9:54am UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/2 "2024-03-30T09:54:13Z")

</div>

This [module](https://github.com/dmolony3/ClipVessel) does just what you want.

The author has [proposed](https://discourse.slicer.org/t/vmtk-surface-clipping-contribution/30456/14) to add it to SlicerVMTK extension, it’s still pending though.

---

<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 30, 2024, 9:14pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/3 "2024-03-30T21:14:21Z")

</div>

Is the ClipVessel module’s author waiting for us to do something?

---

<div class="post-metadata">

**Author:** ![Killmaro](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/killmaro/32/77864_2.png) [@Killmaro](https://discourse.slicer.org/u/Killmaro)\
**Post date:** [April 21, 2024, 4:38pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/4 "2024-04-21T16:38:09Z")

</div>

Thanks for your answer

I ve tried to set it with extension wizard but when I select extension folder “clipvessel” I get the following error :

Traceback (most recent call last):  
File “/Applications/Slicer.app/Contents/bin/…/lib/Slicer-5.6/qt-scripted-modules/ExtensionWizard.py”, line 284, in selectExtension  
xd = SlicerWizard.ExtensionDescription(sourcedir=path)  
File “/Applications/Slicer.app/Contents/bin/Python/SlicerWizard/ExtensionDescription.py”, line 142, in **init**  
self.\_setProjectAttribute(“homepage”, p, required=True)  
File “/Applications/Slicer.app/Contents/bin/Python/SlicerWizard/ExtensionDescription.py”, line 189, in _setProjectAttribute  
v = project.getValue("EXTENSION_" + name.upper(), default, substitute)  
File “/Applications/Slicer.app/Contents/bin/Python/SlicerWizard/ExtensionProject.py”, line 282, in getValue  
raise KeyError(“script does not set %r” % name)  
KeyError: “script does not set ‘EXTENSION\_HOMEPAGE’”

Is there anything to modify in general Slicer settings ?  
And in this case which path should I provide for this EXTENSION\_HOMEPAGE ?

Thanks again for your 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:** [April 21, 2024, 7:49pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/5 "2024-04-21T19:49:16Z")

</div>

> [@Killmaro](#):
>
> set it with extension wizard

The ‘Extension wizard’ is meant for creating extensions and modules based on templates.

You want to use the ClipVessel module. Clone it from the remote repository and drag ClipVessel.py onto Slicer. It will install it very nicely.

---

<div class="post-metadata">

**Author:** ![Killmaro](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/killmaro/32/77864_2.png) [@Killmaro](https://discourse.slicer.org/u/Killmaro)\
**Post date:** [April 21, 2024, 10:13pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/6 "2024-04-21T22:13:39Z")

</div>

Thanks it works, I can run the module and set my cutting points.

However, I have 2 remaining issues:

- After extracting centerlines, my input 3D model disappears. How can I maintain a visual on my 3D input model to position the cutting points in the right places?
- Similarly, after creating my centerlines cut tree, how can I obtain the corresponding output surface?

Thank you in advance for the help

---

<div class="post-metadata">

**Author:** ![DavidM](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@DavidM](https://discourse.slicer.org/u/DavidM)\
**Post date:** [April 23, 2024, 3:11pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/7 "2024-04-23T15:11:53Z")

</div>

I’m not sure if I fully understand the problem. Visibility of any data type in 3D Slicer can be controlled from the data module. You can turn on and off your 3D model here and similarly you can turn on/off the output surface visibility after creating your centerlines cut tree.

---

<div class="post-metadata">

**Author:** ![Killmaro](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/killmaro/32/77864_2.png) [@Killmaro](https://discourse.slicer.org/u/Killmaro)\
**Post date:** [April 23, 2024, 3:35pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/8 "2024-04-23T15:35:35Z")

</div>

![Capture d’écran 2024-04-23 à 17.26.05](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/4/b4bad383b14587dc71b5d5f6f6432ddba3ec8a6f.jpeg)

Yes, I tried to display the 3D model by clicking on the small eye in the ‘data’ module interface, but only the centerlines appear.  
I am using pre-segmented 3D models in .STL format that are imported into slicer maybe that’s why it’s not working…

---

<div class="post-metadata">

**Author:** ![DavidM](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@DavidM](https://discourse.slicer.org/u/DavidM)\
**Post date:** [April 23, 2024, 6:53pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/9 "2024-04-23T18:53:13Z")

</div>

There does not appear to be any other model loaded in your scene in the shared screenshot. Just “test” which appears to be the centerlines and the centerline endpoints.

---

<div class="post-metadata">

**Author:** ![Killmaro](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/killmaro/32/77864_2.png) [@Killmaro](https://discourse.slicer.org/u/Killmaro)\
**Post date:** [April 25, 2024, 10:40am UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/10 "2024-04-25T10:40:13Z")

</div>

Indeed, I was overwriting the input STL file during the extraction of the centerlines. I’ve corrected that, and it’s working now. The result looks good.

 ![Capture d’écran 2024-04-25 à 12.36.20](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/a/0a6e08edf07752933a51346c587dfeae2fb8ad76.jpeg)  
 ![Capture d’écran 2024-04-25 à 12.36.50](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/a/da5cf1045872a82797f2d208032beaba5938e2d4.jpeg)

---

<div class="post-metadata">

**Author:** ![Killmaro](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/killmaro/32/77864_2.png) [@Killmaro](https://discourse.slicer.org/u/Killmaro)\
**Post date:** [April 25, 2024, 10:43am UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/11 "2024-04-25T10:43:19Z")

</div>

However, the clip points are not behaving like beads along the centerlines; they are positioning themselves outside of the surface. Is this normal ?

---

<div class="post-metadata">

**Author:** ![DavidM](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@DavidM](https://discourse.slicer.org/u/DavidM)\
**Post date:** [April 25, 2024, 1:37pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/12 "2024-04-25T13:37:32Z")

</div>

I’m glad to see it worked. Yes, the clip points do not move along the centerline. When you place them I believe 3D Slicer projects them onto the nearest visible surface. It should not matter if I remember correctly as the clip points are used to find the nearest point on the centerline. You can always hide the surface and place them on the centerline if you are having issues when they are on/outside the surface.

---

<div class="post-metadata">

**Author:** ![Killmaro](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/killmaro/32/77864_2.png) [@Killmaro](https://discourse.slicer.org/u/Killmaro)\
**Post date:** [April 27, 2024, 6:59pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/13 "2024-04-27T18:59:25Z")

</div>

I was able to input the trimmed and extended model into my CFD software and it worked correctly. Thank you again for your 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:** [June 25, 2024, 9:42pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/14 "2024-06-25T21:42:10Z")

</div>

> [@lassoan](#):
>
> Is the ClipVessel module’s author waiting for us to do something?

Hi @lassoan ,

I hereby draw your attention that @DavidM has submitted a [PR](https://github.com/vmtk/SlicerExtension-VMTK/pulls) to integrate Clip Vessel in SlicerVMTK. May be you could consider when you have some time.

Ragards.

---

<div class="post-metadata">

**Author:** ![Killmaro](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/killmaro/32/77864_2.png) [@Killmaro](https://discourse.slicer.org/u/Killmaro)\
**Post date:** [July 23, 2024, 5:36pm UTC](https://discourse.slicer.org/t/cutting-vessels-cfd/35165/15 "2024-07-23T17:36:49Z")

</div>

This module needs a list of clip points as input. It’s quite simple with a limited number of vessels; however, it’s harder when there are many. Is there an easy way to create this list by auto-detection (like in the “extract centerline” module), for example, by placing one clip point 5mm above each centerline endpoint? Thank you for your help.
