# Centerline computation failed

**URL:** <https://discourse.slicer.org/t/centerline-computation-failed/11981>\
**Category:** Support\
**Created:** [June 10, 2020, 5:16pm UTC](https://discourse.slicer.org/t/centerline-computation-failed/11981 "2020-06-10T17:16:00Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepa/32/5634_2.png) [@Deepa](https://discourse.slicer.org/u/Deepa)\
**Post date:** [June 10, 2020, 5:16pm UTC](https://discourse.slicer.org/t/centerline-computation-failed/11981/1 "2020-06-10T17:16:00Z")

</div>

Hello Everyone,

I’ve been trying to compute centerlines for [this](https://github.com/DeepaMahm/misc/blob/master/Segmentation4.seg.nrrd) geometry using VMTK extension.

However, I couldn’t successfully obtain centerlines. Even the networkExtraction failed when I tried  
to use the stl file of the same geometry

> reader = vmtkscripts.vmtkSurfaceReader()  
> reader.InputFileName = ‘input.stl’  
> reader.Execute()
> 
> ```
> # network extraction
> networkExtraction = vmtkscripts.vmtkNetworkExtraction()
> networkExtraction.Surface = reader.Surface
> networkExtraction.Execute()
> 
> ```

Could someone kindly look into this?

---

<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 10, 2020, 5:32pm UTC](https://discourse.slicer.org/t/centerline-computation-failed/11981/2 "2020-06-10T17:32:39Z")

</div>

This model contain 2.8 million points.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/5/95b90bfdaf7e5f54521bd28b378afbf4e9e2656e.png)

Centerline extraction may still work but it would take really long time. I would suggest to cut off unnecessary parts in Segment Editor and heavily decimate the exported model in Surface Toolbox.

You may ask for further suggestions for dealing with large models at the VMTK mailing list.

---

<div class="post-metadata">

**Author:** ![Deepa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepa/32/5634_2.png) [@Deepa](https://discourse.slicer.org/u/Deepa)\
**Post date:** [June 11, 2020, 7:54am UTC](https://discourse.slicer.org/t/centerline-computation-failed/11981/3 "2020-06-11T07:54:12Z")

</div>

Hi @lassoan

I wasn’t sure how to select a `Start point` for such geometry since there are many free ends.  
Could you please give some suggestions?

---

<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 11, 2020, 2:21pm UTC](https://discourse.slicer.org/t/centerline-computation-failed/11981/4 "2020-06-11T14:21:28Z")

</div>

If you don’t have any preferred root branch then just choose any larger branch that is connected to most others. Start with a cropped model and apply decimation to have no more than a few ten thousand points. You can then experiment with gradually increasing the region of interest size and tune decimation parameters to reach a good tradeoff between quality and amount of data you get, and computation time on your system.

There may be tricks that long-time VMTK users know about how to handle large networks, so please reach out to them and then report back here that you learned.

---

<div class="post-metadata">

**Author:** ![Deepa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepa/32/5634_2.png) [@Deepa](https://discourse.slicer.org/u/Deepa)\
**Post date:** [June 11, 2020, 3:21pm UTC](https://discourse.slicer.org/t/centerline-computation-failed/11981/5 "2020-06-11T15:21:02Z")

</div>

Hi @lassoan

> [@lassoan](#):
>
> decimation to have no more than a few ten thousand points

Thank you very much. I am working on these lines

May I ask a few doubts?

> [@lassoan](#):
>
> Start with a cropped model

I couldn’t exactly understand how to obtain a cropped model. In the segment editor I try to use “Scissors” , select operation and shape (circle) required. How should I crop the volume after this step? In one of my previous post, you had mentioned Scissors will only blank the voxles. So I am not sure how to crop.

Could you please briefly explain how decimation works? I find a `Reduction`tab that shows (0.8) by default. Does this mean 0.8 percent of the original number of points are removed?

> [@lassoan](#):
>
> no more than a few ten thousand points

May I know which feature can be used to get an estimate of the number of points?

> [@lassoan](#):
>
> There may be tricks that long-time VMTK users know about how to handle large networks, so please reach out to them and then report back here that you learned.

Definitely, I have reached out to them a week back and wrote to them for the second time today. I will wait for their response and share my learnings here.

---

<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 11, 2020, 6:44pm UTC](https://discourse.slicer.org/t/centerline-computation-failed/11981/6 "2020-06-11T18:44:25Z")

</div>

> [@Deepa](#):
>
> I couldn’t exactly understand how to obtain a cropped model. In the segment editor I try to use “Scissors” , select operation and shape (circle) required. How should I crop the volume after this step? In one of my previous post, you had mentioned Scissors will only blank the voxles. So I am not sure how to crop.

If you crop to reduce memory usage then you need to crop the input volume (before you start segmentation) using Crop volume module. If you crop so that you have a network that VMTK can process faster, you can further cut off parts of the image using Scissors tool.

> [@Deepa](#):
>
> Could you please briefly explain how decimation works? I find a `Reduction` tab that shows (0.8) by default. Does this mean 0.8 percent of the original number of points are removed?

Reduction refers to the requested fraction of points to be removed. 0.8 means that you request removal of 80% of points. Probably you want to use values in the 0.9-0.99 range.

> [@Deepa](#):
>
> May I know which feature can be used to get an estimate of the number of points?

Number of points are shown in the tooltip when you hover over your model in Data module. Some more information is shown in Models module / Information section.

> [@Deepa](#):
>
> Definitely, I have reached out to them a week back and wrote to them for the second time today. I will wait for their response and share my learnings here

Explain them in 2-3 sentences who you are, what your project is about, and why it is important. Also attach a screenshot link to example labelmap and segmented model files. Then you have a better chance to get an answer. You may also keep asking 1-2x a week for a couple of weeks, telling what you have tried, and how well those worked.

---

<div class="post-metadata">

**Author:** ![Deepa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepa/32/5634_2.png) [@Deepa](https://discourse.slicer.org/u/Deepa)\
**Post date:** [June 12, 2020, 2:00pm UTC](https://discourse.slicer.org/t/centerline-computation-failed/11981/7 "2020-06-12T14:00:46Z")

</div>

@lassoan

Thanks a lot for the clarifications.

I’ve used the segment editor to extract a really small segment this time (available [here](https://github.com/DeepaMahm/misc/blob/master/Segmentation5.seg.nrrd)). The initial number of points is 188394.

I have reduced by 80 %( started with 95 % initially). The decimated model now has 37602 points.

I get the following output while trying to run Compute centerlines:

> No data to smooth  
> No data to decimate  
> No points to subdivide

When I try for the original model, the centerline computation doesn’t complete even after 30 min.

---

<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 12, 2020, 4:00pm UTC](https://discourse.slicer.org/t/centerline-computation-failed/11981/8 "2020-06-12T16:00:32Z")

</div>

Can you share a download link to a model before and after decimation?

---

<div class="post-metadata">

**Author:** ![Deepa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepa/32/5634_2.png) [@Deepa](https://discourse.slicer.org/u/Deepa)\
**Post date:** [June 13, 2020, 2:18am UTC](https://discourse.slicer.org/t/centerline-computation-failed/11981/9 "2020-06-13T02:18:40Z")

</div>

Hi @lassoan

Please find the model files [before](https://github.com/DeepaMahm/misc/blob/master/Segment5.vtk) and [after](https://github.com/DeepaMahm/misc/blob/master/Segment5_80deci.vtk) decimation.

---

<div class="post-metadata">

**Author:** ![Deepa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepa/32/5634_2.png) [@Deepa](https://discourse.slicer.org/u/Deepa)\
**Post date:** [June 13, 2020, 4:56am UTC](https://discourse.slicer.org/t/centerline-computation-failed/11981/10 "2020-06-13T04:56:13Z")

</div>

@lassoan

I now have the ouput ,[CenterlineComputationModel](https://github.com/DeepaMahm/misc/blob/master/CenterlineComputationModel.vtk), created after centerline computation using the original model (before decimation).

 ![Untitled](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/a/3a43914c677ac440624857d83c270cb8469a3cb0.png)

I see a problem with holes (created during segmentation).

---

<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 20, 2020, 9:51pm UTC](https://discourse.slicer.org/t/centerline-computation-failed/11981/11 "2020-06-20T21:51:57Z")

</div>

The [new Extract centerline module](https://discourse.slicer.org/t/new-module-extract-centerline-in-slicervmtk-extension/12117) has now built-in decimation tuned to work well for vessel centerline model preprocessing.
