Storing multiple arbitrary (point, orientation) pairs with a markups curve

A user gives me a vtkMRMLMarkupsCurveNode (or something similar such as a closed curve). For each of several user-supplied points on the curve (though not necessarily control points), I want to store a camera orientation.

  1. I can specify a user-supplied location along the curve by its world coordinates (3 floating-point numbers) or I could boil it down to a distance along the user’s supplied curve (1 floating-point number).
  2. I can specify the orientation for a location as (angle, axis_x, axis_y, axis_z) or a quaternion (also four floating point numbers), or a 3×3 matrix (which could be a numpy array or vtk.vtkMatrix3x3).

How do I associate several (location, orientation) pairs with the user’s supplied vtkMRMLMarkupsCurveNode? One way I see: create a second vtkMRMLMarkupsCurveNode

  1. Somehow make the second vtkMRMLMarkupsCurveNode subservient to the first one – in a way that it would be saved or loaded each time the save or load operation is applied to the first vtkMRMLMarkupsCurveNode. What’s the best way to associate these?
  2. Set the control points of this subservient vtkMRMLMarkupsCurveNode to be the points where the user has supplied camera orientations.
  3. Use the subservient vtkMRMLMarkupsCurveNode’s method SetNthControlPointOrientation to set the corresponding user-supplied orientation for each of these control points.

Is this the best way to do this? I looked at the vtkMRMLMarkupsCurveNode.SetMeasurement method, but I don’t see how to make the key of a supplied measurement be a 3-dimensional world coordinate position, nor do I see how to make a value of a supplied measurement be an orientation (4-dimensional or 3×3-dimensional).


Hi @Lee_Newberg -

A couple ideas. Since these are rather specific to the endoscopy use case and closely linked to the source curve, I’d consider storing the extra orientation in a node attribute of the curve node, which can be as simple as a json string encoding the values, or you may want to have number keyword-value pairs for the point concepts.

Also, rather than storing the world space values of the points where the camera is defined, I think you’d want to convert them into something parameterized by the path length along the curve, so that if someone edits the curve you can calculate correct relative position so that the control point stays fixed to the curve. You may want to do this in absolute length, or as a percentage of the length along the curve.

As we discussed, you may also want to support either a defined camera orientation at each of the specified points, or a lookat point, which would not need to be updated as the curve is edited.

1 Like