Add vtkVectorText programmatically

I would like to engrave many text models onto a skin model, programmatically, based on a set of markup control point coordinates.

My current approach is to generate vtk.vtkVectorText models, set their location, and subtract the text and skin models. I have successfully loaded vtk model, but vtk.vtkVectorText doesn’t have a set center method (like some other vtk model types types) but rather position is set by a vtkActor. If I understand correctly, in Slicer vtkPolyDataActor and vtkPolyDataMapper are tied into Displayable Managers (Documentation/Nightly/Developers/DisplayableManagers - Slicer Wiki) but don’t see relevant methods to set position.

How can i set the position of a model vtkVectorText inside slicer, which would otherwise be controlled by vtkActor outside of the Slicer environment?

Did you look at this? New text engrave/emboss effect in Segment Editor

I have tried the effect but encountered the unclear text issue noted on the same discussion thread (I have not yet followed through with changing volume spacing to make the text clearer).

In terms of programmatic placement of position, the lines in the link below could then potentially be modified?

You could have a look at how the effect is implemented using VTK:

1 Like

Thank you. I was able to reproduce the segmentation effect so that my text labels can engrave or emboss at specific coordinates. However, when plugging in the arguments into the apply function, the letters engrave upside down relative to the default ‘Test’ text in the GUI, even if I apply a transform to the associated segment model, flipping it 180 degrees. Any idea where this transform is getting applied?

here?: SlicerSegmentEditorExtraEffects/SegmentEditorEngrave/SegmentEditorEngraveLib/SegmentEditorEffect.py at f43df35af66a0b60000b008e0fa061d53319dc78 · lassoan/SlicerSegmentEditorExtraEffects · GitHub