# Centerline Computation

**URL:** <https://discourse.slicer.org/t/centerline-computation/12025>\
**Category:** Support\
**Created:** [June 15, 2020, 4:30am UTC](https://discourse.slicer.org/t/centerline-computation/12025 "2020-06-15T04:30:53Z")\
**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 15, 2020, 4:30am UTC](https://discourse.slicer.org/t/centerline-computation/12025/1 "2020-06-15T04:30:53Z")

</div>

Hello Everyone,

I’m using VMTK module in Slicer to run Centerline Computation for [this](https://github.com/DeepaMahm/misc/blob/master/Segment2.zip) model input using the latest Preview release.

The task has run for nearly 10 hours but it was unsuccessful.

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

The notice that the endpoints are correctly computed and I think the actual problem is while writing the  
centerline properties. CellId and Radius was written to the file, but the other properties are not written to the properties table.

Could someone give this a try? I would like to know if it is successful.

In [this](https://pubmed.ncbi.nlm.nih.gov/11678637/) paper by Luca Antiga, skeletonization of a large network takes 50 seconds.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [June 15, 2020, 5:13am UTC](https://discourse.slicer.org/t/centerline-computation/12025/2 "2020-06-15T05:13:12Z")

</div>

again, the issue is reported in the error message (bad\_alloc). You are running out of memory.

The paper you cite says

> “Thanks to the regularity of the capillary lumenboundary shape, and in order to shorten the comput-ing time, the images were resized at a resolution of 300x300 pixels with bicubic interpolation.”

How big is your volume?

---

<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 15, 2020, 5:18am UTC](https://discourse.slicer.org/t/centerline-computation/12025/3 "2020-06-15T05:18:39Z")

</div>

@muratmaga

> [@muratmaga](#):
>
> again, the issue is reported in the error message (bad\_alloc). You are running out of memory.

Yes, I am running this on a server and I am not sure how much of memory is required for this task.

> [@muratmaga](#):
>
> How big is your volume?

I have used segment editor to extract a subvolume from the original volume.  
 ![Untitled](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/3/133ac2455dd74f2708cfa894b17442cb2e2f9779.png)

> [@muratmaga](#):
>
> Thanks to the regularity of the capillary lumenboundary shape, and in order to shorten the comput-ing time, the images were resized at a resolution of 300x300 pixels with bicubic interpolation.

Thanks a lot for pointing this out. I am not sure how to do this.  
Instead, I tried to use decimation in Surface Toolbox to reduce the number of points. This didn’t help because Centerline Computation could not be initiated using decimated model.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [June 15, 2020, 5:55am UTC](https://discourse.slicer.org/t/centerline-computation/12025/4 "2020-06-15T05:55:56Z")

</div>

Your dataset is way larger than what they used.

I am not familiar with VMTK, or the centerline computation. If that’s a multithreaded task, you can try to find a powerful computer with dozens of cores, and hundreds of GBs of RAM. That will definitely speed up the task.

Otherwise, you can use `Crop Volume` to downsample your images prior to segmentation.

---

<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 15, 2020, 6:15am UTC](https://discourse.slicer.org/t/centerline-computation/12025/5 "2020-06-15T06:15:30Z")

</div>

Thank you.

First I’d like to try `Crop Volume` with the following settings. I’m using the output volume obtained after segmentation as an input here. I hope this is OK.

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

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [June 15, 2020, 3:47pm UTC](https://discourse.slicer.org/t/centerline-computation/12025/6 "2020-06-15T15:47:56Z")

</div>

I am not sure if Crop Volume works with the segmentation nodes directly. I would probably reduce the original volume and redo the segmentation at low resolution. Alternatively, if you don’t want to redo the segmentation, you can export your existing segment as a label map and reduce that (for that make sure to choose the interpolator as nearest neighbors).

Another option I think is to use the segmentation geometry and use a coarser resolution than the master volume.

I honestly do not know which one of these would give you the best fidelity with respect to the original high-resolution volume at reasonable volume sizes. @lassoan and others may have some other suggestion.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [June 15, 2020, 3:48pm UTC](https://discourse.slicer.org/t/centerline-computation/12025/7 "2020-06-15T15:48:57Z")

</div>

@Deepa nevermind, I think you are doing it right. I guess your master volume is a masked volume from the original data. So it should be fine…

---

<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 15, 2020, 4:45pm UTC](https://discourse.slicer.org/t/centerline-computation/12025/8 "2020-06-15T16:45:47Z")

</div>

> [@muratmaga](#):
>
> Alternatively, if you don’t want to redo the segmentation, you can export your existing segment as a label map and reduce that (for that make sure to choose the interpolator as nearest neighbors).

Thank you, I’ll try with nearest neighbors. I did the same steps but used b-spline for interpolator and the cropped volume wasn’t created successfully.

---

<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 15, 2020, 5:12pm UTC](https://discourse.slicer.org/t/centerline-computation/12025/9 "2020-06-15T17:12:33Z")

</div>

Hi @muratmaga  
I am using nearest neighbors this time

 ![Untitled](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/d/ad3d4d288e0ad8bbe709f6d931fe9939c336f865.jpeg)  
For some reason, I find that the cubic box is not fit around 3D vessel segments before cropping. I’m  
not sure if this will affect cropping.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [June 15, 2020, 5:16pm UTC](https://discourse.slicer.org/t/centerline-computation/12025/10 "2020-06-15T17:16:31Z")

</div>

You can modify where the ROI is set. Did you try the fit to volume option?

---

<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 15, 2020, 5:45pm UTC](https://discourse.slicer.org/t/centerline-computation/12025/11 "2020-06-15T17:45:57Z")

</div>

Thank you. Yes, I tried `Fit to Volume`. Unfortunately, it didn’t help
