Representing fields of functions on the unit sphere using e.g. 3D Glyph

Hi, I have a long-standing issue where I struggle to find a good way to plot fields of spherical functions in VTK-based software, including ParaView.

What I have is:

  • A large-ish dataset which consists of (N, M) scalars.
  • N (which can be pretty large, 1 million or more) maps to some rectilinear 3D grid (voxels, generally).
  • M (which is smallish, say 64 to 512) maps to points or cells on the unit sphere using an arbitrary discretization (I am able to sample any points on the sphere in my data).

So what I want to do is to take a subset of N (say a sample of size 250), and at every point in the grid of that subset, I want to draw a spherical function using a 3D glyph or similar filter. Ideally, I would like to be able to manipulate both the radius and the color of the surface of each function-glyph based on my data, preferably with interpolation.

I’m proficient at Python and I have some experience with VTK, but I haven’t used Paraview itself that much - in the past I used various other VTK derivatives like Mayavi, tvtk, pyVista etc, but I was only ever able to accomplish the above by making a big script to create each spherical function individually, and then rendering them all together, which is really rather inconvenient, and I was hoping there is a way to create “rich glyphs” of the kind I’m describing in ParaView. I have access to tons of computing power including extremely high-end GPU:s, so that’s not a limiting factor.

I can structure my input to ParaView in pretty much any way since I create all my data using Python-based software I’ve written myself, but it’s easiest for me to create plain unstructured point meshes with vertex cells, or tetra/octahedral meshes.

For a rough idea of what I’m after, see fig. 1 on p.4 in this preprint of mine which I made using some very cumbersome and inefficient scripting in Mayavi/tvtk: [2305.07750] Small-angle scattering tensor tomography algorithm for robust reconstruction of complex textures You can imagine the spheres in this figure also having their radius scaled by their color value for what I would like to have the option to do.

Thanks in advance!

Hi @leoniel

according to the cited paper, it seems that you are trying to display tensors. Have you tried the Tensor Glyph filter in ParaView, or vtkTensorGlyph in VTK?

Best,
François

I have played a bit with TensorGlyphs (the superquadrics in the same figure are TensorGlyphs, by “hacking” them into Mayavi) but I want to be able to display higher rank tensors than 2, and also apply point-wise coloring (like one scalar value for each theta and phi). If there’s an easy way to color TensorGlyphs that way it would work as a solution for me to distort them by the rank-2 components and color by higher order ones

I don’t normally work with Cartesian tensor representations though (mainly local spline functions and spherical harmonics) so I would prefer an approach that just lets me define an arbitrary function on the sphere, otherwise I have to do post-processing steps that can introduce Gibbs artefacts and the like for local representations. And those transforms are a bit annoying to do for higher order harmonics.