@cpinter has implemented this for SlicerHeart recently. You can store any number of additional properties as static “measurements”.
For example:
markupsNode = getNode('F')
# Create a VTK array that contains the custom data
landmarkTypesArray = vtk.vtkDoubleArray()
for controlPointIndex in range(markupsNode.GetNumberOfControlPoints()):
landmarkTypesArray.InsertNextValue(1 if controlPointIndex % 3 else 0)
# Add the landmark array as static measurement
landmarkTypes = slicer.vtkMRMLStaticMeasurement()
landmarkTypes.SetName('LandmarkType2')
landmarkTypes.SetUnits('')
landmarkTypes.SetPrintFormat("")
landmarkTypes.SetControlPointValues(landmarkTypesArray)
markupsNode.AddMeasurement(landmarkTypes)
These measurements can be used in other measurements and can be used for coloring curves. It could be used for coloring control points; and could be displayed in the control points table.
Measurement results are stored in the json file in measurements
section like this:
{
...
"markups": [
{
"type": "Fiducial",
"coordinateSystem": "LPS",
"locked": false,
"labelFormat": "%N-%d",
"controlPoints": [
{
"id": "1",
"label": "F-1",
"description": "",
"associatedNodeID": "",
"position": [-72.46376811594203, 10.869565217391298, 0.0],
"orientation": [-1.0, -0.0, -0.0, -0.0, -1.0, -0.0, 0.0, 0.0, 1.0],
"selected": true,
"locked": false,
"visibility": true,
"positionStatus": "defined"
},
{
"id": "2",
"label": "F-2",
"description": "",
"associatedNodeID": "",
"position": [-29.89130434782608, -44.384057971014517, 0.0],
"orientation": [-1.0, -0.0, -0.0, -0.0, -1.0, -0.0, 0.0, 0.0, 1.0],
"selected": true,
"locked": false,
"visibility": true,
"positionStatus": "defined"
},
...
],
"measurements": [
{
"name": "LandmarkType",
"enabled": true,
"value": 0.0,
"printFormat": "%.0f",
"controlPointValues": [
0.0,
1.0,
1.0,
0.0,
1.0,
1.0,
0.0,
1.0,
1.0
]
}
],
"display": {
...
]
}
When this json file is manually edited then this data organization makes it easy to add/remove these additional properties, but it is difficult to add/remove points or find values of custom properties.
This is all very new, so we can still modify anything (change API, file format, add convenience functions, etc.) as needed.