Vmtk surface clipping contribution

I have developed a vmtk module that truncates/clips a vessel at user specified markup points (see image). This is a task that is commonly required for CFD software. I am wondering whether there is interest in contributing this to (I don’t think any of the current modules do this) the vmtk extension? If so it may be worth discussing some design considerations before submission.

1 Like

I just want to follow-up on this. Should I submit a pull request on github? I was not able to add this to the vmtk extension on my own computer. Not sure if it needs to be done from compilation.

Have you considered ‘Dynamic modeler’ module? It is integrated in Slicer and can cut models in many ways.

Thanks for highlighting this module. It looks to be quite powerful module but after trying I did not find it easy to clip a vessel normal to a centerline (and add flow extensions) as generally needed for CFD simulations. VMTK has a lot of functionality for this specific purpose.

Ok, I see 3 options then.

  1. Find the closest point (p1) on the centerline to a fiducial point; get the closest centerline point to p1 (p2); this enables you to get a direction vector (v1); create a markups plane; position its first point at p1; set its normal as v1; use ‘Dynamic Modeler’ to cut your surface.

  2. For a single tube (no bifurcations), set as many endpoints (fiducial) as needed where you want to chop the tube; create a centerline with ‘Extract centerline’ module; use ‘Branch clipper’ module to split the input tube.

  1. Clip your surface at a lower level; you can get inspiration here.

Thanks for demonstrating this and sharing the example. I think there was a little misunderstanding as I have already create an extension to perform this task. I have uploaded to github here - GitHub - dmolony3/ClipVessel: 3D Slicer extension for clipping or truncating 3D arteries.

I’m trying to see if there is interest in contributing this repository to the current vmtk extension and if so how to go about integrating

I had a look at your module with much interest, it does what it says in most situations.

But this segmentation is stumbling.


The picture shows that the clipping may be weird and result in unexpected flow extension. As we play with the parameters and point locations, it would sometimes suddenly give expected results. You may download the sample MRB file and place endpoints and clippoints at arbitrary locations to check on your own.

I suspect it’s because the tubes are almost parallel. May be there’s some optimisation to do. Or declare a well defined limitation.

As for merging it in SlicerVMTK as a contribution, this decision belongs to Slicer core developers. I would recommend requesting a review by @lassoan in particular.


Thanks for doing some testing of the module, I did try your geometry and I could not replicate, though I’m sure it can behave unexpectedly in cases. In particular, as you mention, vessels running parallel close to each other could be problematic. Are you able to share the markup points that produce the output above with me?

Here is a complete scene file.

I think that surrounding vessels that do not have a centerline, I.e, not studied, must be removed by the user before performing the clipping. May be it should be clearly stated in the documentation.

Adding the module to the SlicerVMTK extension sounds like a great idea.

:+1: Welcoming more contributors is always a good idea.

Yes, this seems to be the issue. I was able to generate the correct output for your provided markup points by removing unconnected regions. However, this does not work in all cases where branches do not have centerlines. I have made an edit to the documentation that all branches/vessels should contain a centerline. Again, thanks for testing.

Great. Can you provide some guidance on how to add it to the current extension. I know I need to make a pull request and I think I need to edit the CMakeLists.txt file. Are there other changes that need to be made?

These steps should complete the contribution submission.

Fork the SlicerVMTK repository on github in your own repository.
Clone the forked repository.

Create a branch in your cloned repository (on your machine) (creating a branch is not compulsory).
Add the ClipVessel directory at its root (the one containing ClipVessel.py).
Insert an ‘add_subdirectory(ClipVessel)’ instruction in SlicerVMTK’s root CMakeLists.txt file.
Move the documentation to the Docs directory and update accordingly.
Add an entry in the README.md file in SlicerVMTK’s root to point to your module.

Push to your forked repository (master or your created branch) .
Create the pull request.

1 Like

Thanks, will go ahead and do this.