Exporting Curvature Data

Hello everyone,

I am using the Slicer VMTK extension in order to extract centerlines from a vascular tree. In addition to radius, I would also like to have the curvature at every point of the centerline (like I would get from “vmtkcenterlinegeometry” command using VMTK alone).
So far I found that the markups module internally calculates the curvature of an extracted centerline curve (which it uses to find the curvature mean and max measurements and also to color the centerline when chosen as active scalar). Unfortunately I cannot find a way to export these values. Whichever way of saving I choose (e.g. as Markups JSON), it only contains curvature mean/curvature max and radius, but not a curvature value per point. Is there any way to export/save these values which slicer seemingly calculates internally already?

At the moment I am trying to look into the python interactor in order to try and get my hands on them, but as I am not familiar with the VTK framework I am having a hard time finding the measurement data.

Any help would be greatly appreciated!

No one has an idea for this?

I found out that I can access scalar data (the PedigreeIDs) of the markups curve using

res = slicer.util.arrayFromMarkupsCurveData(node, "PedigreeIDs")

but it does not work for curvature data:

res = slicer.util.arrayFromMarkupsCurveData(node, "Curvature")

always gives ValueError: Input markupsNode does not contain curve point data array ‘Curvature’. Available array names: ‘PedigreeIDs’

I do know the curvature values must be stored somewhere though, as I can use them as active scalar on display:

Could anyone give me a hint on what to look into?

I was almost there…
Found out that I was missing one argument to get the Curvature data, which was setting the ‘world’ parameter to True:

res = slicer.util.arrayFromMarkupsCurveData(node, "Curvature", world=True)

Maybe someone else can profit from this knowledge. The question can be marked as solved.

Good to hear you were able to sort this out. I hadn’t used the feature myself but I see the documentation mentioned that flag. Maybe you didn’t have a chance to look or it wasn’t clear?

https://slicer.readthedocs.io/en/latest/developer_guide/slicer.html#slicer.util.arrayFromMarkupsCurveData

Curvature measurement is a dynamic measurement, computed only in world space, so it is not stored in the markup file. However, you can easily get the curve measurements from the markup node using arrayFromMarkupCurveData after you enabled curvature computation:

curveNode = getNode('OC')
curveNode.GetMeasurement('curvature mean').SetEnabled(True)
curvature = arrayFromMarkupsCurveData(curveNode, "Curvature", world=True)
plot(curvature)