# is it able to cut a pipe by given a circle vertices on it, by SelectPolyData/ImplicitSelectionLoop?ERROR:Can't follow egde. Set EdgeSearchMode to Dijkstra.

**URL:** https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894
**Category:** Support
**Created:** [May 16, 2024, 10:02am UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894 "2024-05-16T10:02:27Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![gpu](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e47c2d/32.png) [@gpu](https://discourse.vtk.org/u/gpu)
#### Post date: [May 16, 2024, 10:02am UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/1 "2024-05-16T10:02:27Z")

</div>

is it able to cut a pipe by given a circle vertices on it, by SelectPolyData/ImplicitSelectionLoop?  
test and get ERROR:Can’t follow egde. Set EdgeSearchMode to Dijkstra to avoid this error.  
Thanks!

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [May 17, 2024, 2:12am UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/2 "2024-05-17T02:12:37Z")

</div>

You can set EdgeSearchMode to Dijkstra to avoid this error.

---

<div class="post-metadata">

### Author: ![gpu](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e47c2d/32.png) [@gpu](https://discourse.vtk.org/u/gpu)
#### Post date: [May 21, 2024, 1:49am UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/4 "2024-05-21T01:49:45Z")

</div>

Thanks!  
it’s able to run, but the result seems not right…the mesh was not precisely cut into 2 parts by the ‘loop’ which is a irregular ring which is get from:  
set vtkPlane to vtkCutter  
then vtkPolyDataConnecticity-\>SetInputData(vtkCutter-\>GetOutput()) & SetExtractionModeToClosestPointRegion & setClosestPoint(pickPointOn1Branch)  
then Ring = connectFilter-\>GetOutput;

i want to cut at the pickPoint on 1 branch, while keep all the other branches not cut.

is there any way to do this using VTK?  
if SelectPolyData or ImplicitSelectionLoop is the right way, is there anything to notice when use them? eg. the points must be the mesh vertex or on the triangle?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [May 21, 2024, 1:41pm UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/5 "2024-05-21T13:41:53Z")

</div>

What shape would you like to cut? What are your requirements? Can you show a few screenshots to illustrate?

---

<div class="post-metadata">

### Author: ![gpu](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e47c2d/32.png) [@gpu](https://discourse.vtk.org/u/gpu)
#### Post date: [May 22, 2024, 1:29am UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/6 "2024-05-22T01:29:55Z")

</div>

tree with branches, or blood vessel, this kind of hollow mesh

---

<div class="post-metadata">

### Author: ![gpu](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e47c2d/32.png) [@gpu](https://discourse.vtk.org/u/gpu)
#### Post date: [May 22, 2024, 1:39am UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/7 "2024-05-22T01:39:01Z")

</div>

![image](https://discourse.vtk.org/uploads/default/original/2X/e/e92416d7e77e1577a7674f2cabc77be77c09d551.jpeg)

---

<div class="post-metadata">

### Author: ![gpu](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e47c2d/32.png) [@gpu](https://discourse.vtk.org/u/gpu)
#### Post date: [May 23, 2024, 8:10am UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/8 "2024-05-23T08:10:10Z")

</div>

eg. in the above picture, there are 3 meshes with different colors, is there any good way to Cut just a single branch at the Picked point by VTK  
Thanks!

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [May 23, 2024, 1:13pm UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/9 "2024-05-23T13:13:12Z")

</div>

Manipulating vessel trees is a special case which has many solutions.

For convenient editing with a graphical user interface: Snipping off branches is really easy if you use binary labelmap representation for your segmentation, as you can erase a small piece of the vessel by a single click where you want to clip and then keep the largest connected component. It takes just a few clicks in 3D Slicer: load your mesh, right-click in Data module to convert to segmentation, in Segment Editor module click with the Erase tool where you want to snip, and then use Islands effect to keep the largest island.

For automated vessel mesh processing in Python or C++, you can use VMTK toolkit.

---

<div class="post-metadata">

### Author: ![gpu](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e47c2d/32.png) [@gpu](https://discourse.vtk.org/u/gpu)
#### Post date: [May 24, 2024, 1:39am UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/10 "2024-05-24T01:39:14Z")

</div>

is there any way to only use VTK? how about the vtkClipPolyData, vtkCutter, etc.  
the vessel mesh and its centerline data were known.  
Thanks!

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [May 24, 2024, 2:13pm UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/11 "2024-05-24T14:13:11Z")

</div>

You can use VTK, you just need to put in some work to develop a tool that does exactly what you need. VMTK is based on VTK and implements exactly these tools, so that you don’t have to reimplement.

---

<div class="post-metadata">

### Author: ![gpu](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e47c2d/32.png) [@gpu](https://discourse.vtk.org/u/gpu)
#### Post date: [May 26, 2024, 3:27pm UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/12 "2024-05-26T15:27:24Z")

</div>

thanks, if do this by myself, what classes should i use? or is there a clear way include the steps to reach the goal?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [May 26, 2024, 3:36pm UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/13 "2024-05-26T15:36:54Z")

</div>

I don’t have any specific recommendations within VMTK. Community support is available [here](https://discourse.slicer.org/c/community/vmtk/28). [This page](http://www.vmtk.org/) is a good starting point.

---

<div class="post-metadata">

### Author: ![gpu](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e47c2d/32.png) [@gpu](https://discourse.vtk.org/u/gpu)
#### Post date: [May 28, 2024, 3:10am UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/14 "2024-05-28T03:10:46Z")

</div>

thanks! but i mean is it possible to this with VTK & without VMTK, and is there already existed algorithm in VTK?

---

<div class="post-metadata">

### Author: ![gpu](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e47c2d/32.png) [@gpu](https://discourse.vtk.org/u/gpu)
#### Post date: [June 3, 2024, 9:09am UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/15 "2024-06-03T09:09:34Z")

</div>

it’s very easy to only cut the clicked branch IF every branches are meshes, BUT not the whole vessel tree is a big mesh.  
Is there some way to split the big mesh to many small meshes which each one is just a single branch?  
then a multi-branch tree data structure can be used.  
Thanks!

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [June 3, 2024, 12:25pm UTC](https://discourse.vtk.org/t/is-it-able-to-cut-a-pipe-by-given-a-circle-vertices-on-it-by-selectpolydata-implicitselectionloop-error-cant-follow-egde-set-edgesearchmode-to-dijkstra/13894/16 "2024-06-03T12:25:48Z")

</div>

> [@gpu](#):
>
> Is there some way to split the big mesh to many small meshes which each one is just a single branch?

Yes, VMTK can split the vessel tree to branches.
