[vtkusers] Equation Rendering Using Python

Allie Vacanti allison.vacanti at kitware.com
Tue Feb 19 09:05:58 EST 2019


Internally, VTK renders text using vtkTextRenderer, which automatically
supports equation rendering when vtkRenderingMatplotlib is enabled. Any
code using vtkTextRenderer to generate a texture/path from a string gets
this capability, including vtkTextActor, vtkTextActor3D, vtkTextMapper, and
vtkBillboardTextActor3D.

If you have your own image data that you've been rendering yourself and
want to display it as text, you can built a rectangular polydata and apply
the image data as a texture. Take a look at the implementation of
vtkBillboardTextActor3D for a good example of this:

https://github.com/Kitware/VTK/blob/master/Rendering/Core/vtkBillboardTextActor3D.cxx

HTH,
Allie

On Tue, Feb 19, 2019 at 8:48 AM Dan Lipsa <dan.lipsa at kitware.com> wrote:

> Not that I am aware of. I would look at how TestMathTextActor.cxx is
> implemented.
>
>  @Allison Vacanti <allison.vacanti at kitware.com> might give you better
> pointers.
>
> On Tue, Feb 19, 2019 at 5:52 AM akaszynski <akascap at gmail.com> wrote:
>
>> While I could rebuild vtk locally, I’m building a python module that
>> assumes
>> the user only has access to the python wheel built for vtk on PyPi, which
>> hasn’t included support for equation rendering.
>>
>> Regardless, I can still generate rendered equations and even feed it into
>> a
>> vtkImageData object.  Is there an example of how I can connect this object
>> to an existing text label or text property?  This appears to be the
>> approach
>> that’s used internally by vtk to take externally rendered images and place
>> them where plain text would normally be.
>>
>> Examples in Python or C++ (really any language) would be great.
>>
>> Thanks in advance for your help!
>>
>>
>>
>> --
>> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> https://vtk.org/mailman/listinfo/vtkusers
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20190219/5dce2fef/attachment.html>


More information about the vtkusers mailing list