Display text near points

Hi,

I’m looking for a way to display text at each point from point cloud. In the best scenario the text should have the constant size regardless of the distance between camera position and point and the text should be faced to the camera. Something similar to LabeledDataMapper vtk example

Is vtkLabeledDataMapper the right choice? I guess in that case I would need to implement custom displayable manager right?

Solved that with vtkCaptionActor2D. I’ve found it by the link.
vtkCaptionActor2D neither affected by zoom nor by inequal aspect ratio. Thus it is pretty good for me.

Adding observers to caption actor allows to react on events like TransformModifiedEvent (when the node is transformed/moved for example), or DisplayModifiedEvent (when visibility of node is changed).

This is implemented in displayable manager thus ::OnMRMLSceneNodeAdded() and ::OnMRMLSceneNodeRemoved() maybe used to create/delete caption actor when necessary.

image

Also there is a vtkMRMLNode::IDChangedEvent but no NameChanged am I right? Or there is something different that may be used when the node’s name is changed?

When there’s no fine-grained event to observe you can typically just observe ModifiedEvent. If you end up getting too many events from that you could propose to add a more specialized event.

1 Like