# VMTK extract centerline fails with VMTK using VTK9

**URL:** <https://discourse.slicer.org/t/vmtk-extract-centerline-fails-with-vmtk-using-vtk9/18644>\
**Category:** Development\
**Tags:** vmtk, vmtk-centerline\
**Created:** [July 12, 2021, 4:38pm UTC](https://discourse.slicer.org/t/vmtk-extract-centerline-fails-with-vmtk-using-vtk9/18644 "2021-07-12T16:38:38Z")\
**Posts on this page:** 4\
**Page:** 1

<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:** [July 12, 2021, 4:38pm UTC](https://discourse.slicer.org/t/vmtk-extract-centerline-fails-with-vmtk-using-vtk9/18644/1 "2021-07-12T16:38:38Z")

</div>

Using 4.13.0-2021-07-11 r30039 / 27f99af factory built, and factory SlicerVMTK-Extension on Arch Linux.

Network models and curves are generated.  
—  
Tree model fails : 0 point, 0 cell. No errors in Python console. Application log reports :

```auto
Found CommandLine Module, target is /home/user/programs/Test/Slicer-4.13.0-2021-07-11-linux-amd64/bin/../lib/Slicer-4.13/cli-modules/Decimation
ModuleType: CommandLineModule
Decimation command line: 

/home/user/programs/Test/Slicer-4.13.0-2021-07-11-linux-amd64/bin/../lib/Slicer-4.13/cli-modules/Decimation --reductionFactor 0.925105 --method FastQuadric --deleteBoundary --aggressiveness 4 /tmp/Slicer/CGCCEF_vtkMRMLModelNodeBG.obj /tmp/Slicer/CGCCEF_vtkMRMLModelNodeBH.obj 

Decimation standard output:

Input: 66760 vertices,133472 triangles (target 9996)
Output: 8463 vertices,16920 triangles (0.873232 reduction)

Decimation completed without errors

ReadDataInternal (vtkMRMLModelStorageNode6): File /tmp/Slicer/CGCCEF_vtkMRMLModelNodeBH.obj does not contain coordinate system information. Assuming LPS.

End of Centerline Computation..
vtkvmtkSimplifyVoronoiDiagram::RequestData is not functionnal when built against VTK >= 9

Algorithm vtkvmtkSimplifyVoronoiDiagram(0x13e1ab70) returned failure for request: vtkInformation (0x13d1dd00)
  Debug: Off
  Modified Time: 32642077
  Reference Count: 1
  Registered Events: (none)
  Request: REQUEST_DATA
  FROM_OUTPUT_PORT: 0
  ALGORITHM_AFTER_FORWARD: 1
  FORWARD_DIRECTION: 0

Cost function array with name specified does not exist!

Cost function array with name specified does not exist!

Descent array with name specified does not exist!

```

—

Tree curve fails with the following errors in Python console:

```auto
Failed to compute results: 'NoneType' object has no attribute 'GetValue'
Traceback (most recent call last):
  File "/home/user/programs/Test/Slicer-4.13.0-2021-07-11-linux-amd64/NA-MIC/Extensions-30039/SlicerVMTK/lib/Slicer-4.13/qt-scripted-modules/ExtractCenterline.py", line 318, in onApplyButton
    self.logic.createCurveTreeFromCenterline(centerlinePolyData, centerlineCurveNode, centerlinePropertiesTableNode, curveSamplingDistance)
  File "/home/user/programs/Test/Slicer-4.13.0-2021-07-11-linux-amd64/NA-MIC/Extensions-30039/SlicerVMTK/lib/Slicer-4.13/qt-scripted-modules/ExtractCenterline.py", line 914, in createCurveTreeFromCenterline
    self.addCenterlineCurves(mergedCenterlines, centerlineCurveNode)
  File "/home/user/programs/Test/Slicer-4.13.0-2021-07-11-linux-amd64/NA-MIC/Extensions-30039/SlicerVMTK/lib/Slicer-4.13/qt-scripted-modules/ExtractCenterline.py", line 923, in addCenterlineCurves
    self._addCenterline(mergedCenterlines, replaceCurve=centerlineCurveNode)
  File "/home/user/programs/Test/Slicer-4.13.0-2021-07-11-linux-amd64/NA-MIC/Extensions-30039/SlicerVMTK/lib/Slicer-4.13/qt-scripted-modules/ExtractCenterline.py", line 950, in _addCenterline
    groupId = mergedCenterlines.GetCellData().GetArray(self.groupIdsArrayName).GetValue(cellId)
AttributeError: 'NoneType' object has no attribute 'GetValue'

```

—  
And these in application log :

```auto
Found CommandLine Module, target is /home/user/programs/Test/Slicer-4.13.0-2021-07-11-linux-amd64/bin/../lib/Slicer-4.13/cli-modules/Decimation
ModuleType: CommandLineModule
Decimation command line: 

/home/user/programs/Test/Slicer-4.13.0-2021-07-11-linux-amd64/bin/../lib/Slicer-4.13/cli-modules/Decimation --reductionFactor 0.925105 --method FastQuadric --deleteBoundary --aggressiveness 4 /tmp/Slicer/CGCCEF_vtkMRMLModelNodeBI.obj /tmp/Slicer/CGCCEF_vtkMRMLModelNodeBJ.obj 

Decimation standard output:

Input: 66760 vertices,133472 triangles (target 9996)
Output: 8463 vertices,16920 triangles (0.873232 reduction)

Decimation completed without errors

ReadDataInternal (vtkMRMLModelStorageNode7): File /tmp/Slicer/CGCCEF_vtkMRMLModelNodeBJ.obj does not contain coordinate system information. Assuming LPS.

End of Centerline Computation..
vtkvmtkSimplifyVoronoiDiagram::RequestData is not functionnal when built against VTK >= 9

Algorithm vtkvmtkSimplifyVoronoiDiagram(0xc3f9920) returned failure for request: vtkInformation (0x1a29ae40)
  Debug: Off
  Modified Time: 33443953
  Reference Count: 1
  Registered Events: (none)
  Request: REQUEST_DATA
  FROM_OUTPUT_PORT: 0
  ALGORITHM_AFTER_FORWARD: 1
  FORWARD_DIRECTION: 0

Cost function array with name specified does not exist!

Cost function array with name specified does not exist!

Descent array with name specified does not exist!

Failed to compute results: 'NoneType' object has no attribute 'GetValue'
RadiusArray with name specified does not exist

RadiusArray with name specified does not exist

Failed to compute results: 'NoneType' object has no attribute 'GetValue'
Traceback (most recent call last):
  File "/home/user/programs/Test/Slicer-4.13.0-2021-07-11-linux-amd64/NA-MIC/Extensions-30039/SlicerVMTK/lib/Slicer-4.13/qt-scripted-modules/ExtractCenterline.py", line 318, in onApplyButton
    self.logic.createCurveTreeFromCenterline(centerlinePolyData, centerlineCurveNode, centerlinePropertiesTableNode, curveSamplingDistance)
  File "/home/user/programs/Test/Slicer-4.13.0-2021-07-11-linux-amd64/NA-MIC/Extensions-30039/SlicerVMTK/lib/Slicer-4.13/qt-scripted-modules/ExtractCenterline.py", line 914, in createCurveTreeFromCenterline
    self.addCenterlineCurves(mergedCenterlines, centerlineCurveNode)
  File "/home/user/programs/Test/Slicer-4.13.0-2021-07-11-linux-amd64/NA-MIC/Extensions-30039/SlicerVMTK/lib/Slicer-4.13/qt-scripted-modules/ExtractCenterline.py", line 923, in addCenterlineCurves
    self._addCenterline(mergedCenterlines, replaceCurve=centerlineCurveNode)
  File "/home/user/programs/Test/Slicer-4.13.0-2021-07-11-linux-amd64/NA-MIC/Extensions-30039/SlicerVMTK/lib/Slicer-4.13/qt-scripted-modules/ExtractCenterline.py", line 950, in _addCenterline
    groupId = mergedCenterlines.GetCellData().GetArray(self.groupIdsArrayName).GetValue(cellId)
AttributeError: 'NoneType' object has no attribute 'GetValue'

```

—

Same observations with home built Slicer and SlicerVMTK-Extension.

That’s since SlicerVMTK-Extension built with VTK9.

My last VTK8 builds were fine.

Regards.

---

<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:** [July 12, 2021, 5:34pm UTC](https://discourse.slicer.org/t/vmtk-extract-centerline-fails-with-vmtk-using-vtk9/18644/2 "2021-07-12T17:34:46Z")

</div>

Unfortunately, Voronoi smoothing is currently broken (VTK API drastically changed, which requires update of the filter). For now, you need to disable this feature by setting `centerlineFilter.SetSimplifyVoronoi(0)` here:

> <https://github.com/vmtk/SlicerExtension-VMTK/blob/d47d8ce70b3222ca08ea40ac27ce1f56e1ef9137/ExtractCenterline/ExtractCenterline.py#L705>

It would be great if you could test this and if everything works well then submit a pull request with this change.

---

<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:** [July 12, 2021, 6:47pm UTC](https://discourse.slicer.org/t/vmtk-extract-centerline-fails-with-vmtk-using-vtk9/18644/3 "2021-07-12T18:47:53Z")

</div>

> [@lassoan](#):
>
> For now, you need to disable this feature

Setting SetSimplifyVoronoi(0) does allow the centerline model and curve to be created.

I pushed the change, but it is merged in the [PR](https://github.com/vmtk/SlicerExtension-VMTK/pull/32) already open for Centerline metrics. Though I clicked ‘New pull request’ in my fork. Is it a problem ? How should I do otherwise ?

Thanks.

---

<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:** [July 12, 2021, 7:29pm UTC](https://discourse.slicer.org/t/vmtk-extract-centerline-fails-with-vmtk-using-vtk9/18644/4 "2021-07-12T19:29:10Z")

</div>

Thank you, I’ve cherry-picked your commit (and added a version check so that the smoothing is still performed in older Slicer versions).

You pushed the change into the same branch, probably that’s why it is included in the same open pull request that you have for that branch.
