Hyperstreamlines for recent Paraview Versions

I wanted to test vtkHyperStreamlines and found hints to this plugin, posted in the old bugtracker: https://vtk.org/Bug/view.php?id=8424

Unfortunately, many things seems to have changed in between and the plugin is not directly usable. Without ever written a plugin before, I started to change things, according to the wiki and now the plugin loads: HyperStreamlines_formatted.xml (6.2 KB)
I tested on the omega data that is given in the bugtracker. However, here it crashes with a segfault if I choose direction “Both” and does not show anything when “Forward” or “Backward” is selected.

I’m not sure why it segfaults but I suspect that the wrong dataset is used? Is there any way to re-write the plugin, such that I can choose which input data is used? That would also be important, because I typically have several tensorial quantities in one file.
I played around with StringVectorProperty but I do not really understand how that is supposed to work with tensorial data and how it is then linked to the Input.

Is there maybe also a new version of this plugin available anywhere, so I do not need to fix that one?

edit: I played around with it a bit more and it looks like I got at least the part where I can select the input array.
HyperStreamlines_formatted.xml (7.0 KB)

However, it still crashes when I try it on data. I have a sample file, which has tensors at points:
mia_res_backgroundGrid.vtk (6.2 KB)
Here, I can apply the filter directly, but there it crashes somewhere in FindCell - and I suspect that the problem is, that some cells are required?

However, If I use a file where the tensors are at cell centers, and I apply the cell center filter first, it crashes at vtkPolyData::GetCell. Here is an example file to reproduce that crash:
mia_res.vtk (54.7 KB)

editedit: Aha! It does not crash if I select on the second file if I select “Cell Data to Point Data” Filter instead of “Cell Center”.
However, in that case, the tensors get interpolated to the vertices of the element, which is something I do not want.

Indeed, it was 15 years ago.

Is there any way to re-write the plugin, such that I can choose which input data is used?

What does hyperstreamlines does that the current streamtracer does not ?

It can visualize Eigenvalue-stream-traces of 2nd rank tensors.

The problem I have is, that I want to stream-trace orientation tensors (or actually only the first principal component, i.e., largest eigenvalue/eigenvector). These have the property, that the vector \bf{v} is the same as the vector -\bf{v} or as Benger and Hege (Strategies for Direct Visualization of Second-Rank Tensor Fields | SpringerLink) put it:

The sign of eigenvectors is undefined, since -\bf{v} is a solution of the eigenvalue equation g\cdot \bf{v} = \lambda\bf{v} as well. We may call a vector whose sign is left open a ‘pre-vector’ (as a not yet fully determined vector).

Or is there a setting in the StreamTracer to plot such “pre-vectors”?

Here is an example (see file mia_res.vtk in initial post):
Plotting the OrientMax vectors, you can see that some have negative sign

If I run now the stream-tracer, I do not get continous lines, but they stop where the vector sign changes or they have these kinks in them:

Indeed not supported by the streamtracer.

vtkHyperStreamLine is still present in VTK and seems be tested by a single test that is executed by CI, so it should be functionnal: https://open.cdash.org/test/1437538507

However, in that case, the tensors get interpolated to the vertices of the element, which is something I do not want.

Seems to be a limitation of that filter I’m afraid.

okay, thanks. I suspect that the filter needs the tensors at points but also requires cells. Thus, if I use the CellCenters filter, I only have points without cells. Is there any way to check what the filter requires?

This is how far I can get:

What is interesting, is that I thought the integration direction (here major eigenvalue) would then also be the stream direction - but apparently the filter works different than that? Or the eigenvalues are wrongly calculated/extracted? I have no idea :confused:
Another limitation (also noticed in the bugtracker) is that I only have a single seed point and not a point cloud like in the StreamTracer, thus I always get a single streamline.

https://gitlab.kitware.com/vtk/vtk/-/blob/master/Filters/General/vtkHyperStreamline.h?ref_type=heads

https://gitlab.kitware.com/vtk/vtk/-/blob/master/Filters/General/vtkHyperStreamline.cxx?ref_type=heads

Since @Will_Schroeder wrote this filter 28 Years ago, I’m sure he will be able to help you :sweat_smile:

Sorry for the joke, but looks like you are a bit on your own here. However it you think you can improve the filter, that would be much welcome! :slight_smile:

1 Like

:joy:

first, I have to understand more of how VTK works internally - so far I only have been a user :wink:
For me, it seems like it is easier to tweak the input data, i.e., providing the tensors in the right locations. The data is written by my own scripts, so it is relatively easy to change it there.

I’ll try to understand what the filter needs and try to give the correct data.

1 Like

Judging from the code, the cells are required for the integration somehow.
Thus, I converted my input mesh by calculating the vertex position as the centroids of all cells and then using Delaunay to get me a tetrahedral mesh.
With this adjustment, I can directly apply the vtkHyperStreamline to the data, without the need for CellCenter of CellDataToPointData filters:
mia_res_new_cctet.vtk (55.0 KB)

That is nice - especially as I can also use the TensorGlyph now without messing around, but the result looks roughly the same…
And I still do not understand why the direction is not correct.
Here is with IntegrationDirection = Major:

The Streamline is however not in the direction of the largest Eigenvalue.

As a reference, this is with Direction = Minor:

In this case it looks like that actually the Major Eigenvalue is followed, but mirrored?!
Almost as if the dataset is given in wrong orientation, i.e., zyx instead of xyz?

Or do I misunderstand the integration direction here? I thought the results should look similar to the StreamTracer when I manually use the major Eigenvector.

1 Like