Apparently the MITK migration to VTK9 broke the 2D fiber mapper, specifically the shader. It's probably necessary to look into the VTK handling of the shader, the shader itself and also into the MITK related input to the shader, such as the plane geometry that is used to calculate the clipping plane.
Original description of the issue by Nil Goyette:
I've been trying to port our application to MITK 2021.02. I usually look at mitk-diffusion because we both work with the FiberBundle class and this helps me a lot! (Thank you Peter). However, I have a problem that I'm unable to solve. The 2D FiberBundle doesn't seem to work with vtk9. See https://i.imgur.com/d8I2PtP.png
The crosshair is in the middle of a set of streamlines but we only see them in the sagittal view. If I want to see them in the other views, I need to place the crosshair at a "random" location. To see them in all views, I need to be at a weird location that is not the center of the image.
The streamlines are visible only in 3 slices. If I go further than that, they simply disappear. But they are completely visible like in the 3D view. I tried changing the Fiber2DSliceThickness property. To have an "acceptable" result, I need to use a really small number like 0.01. The screenshot above is using 0.1. At 0.5, I can see the whole streamlines. It's as if the streamlines are not where we see them. As if they were really tiny. Or the shaders are simply broken on vtk9.
I can clearly see that the mapper in mitk-diffusion (latest release using VTK 8.1.0) works, so I tried removing our modifications as much as possible to be as identical to mitk-diffusion as possible. I'm using the same TrackVis loader, FiberBundle, mapper 2D 3D, etc. It didn't change anything.
At that point, I'm already at several days of debugging, I don't know what to try and I would gladly accept any help!
Hi Peter, thank you for the quick fix. I finally took the time to test... 2 months later :)
- It does work. I loaded a 428Mb dataset (129k streamlines) and I can see them in the three 2D views. Perfect.
- It's slow! The clipping plane trick is an interesting solution, but it's terribly slow on bigger datasets. It takes at least one second to change slice, which makes it unusable for our use-case.
With the shader, moving around in the 2D views was super fast (real time), wathever the number of streamlines. I'm totally not an expert in graphic programming, but I think we need a shader solution here; there's nothing faster. Do you have any idea on how to fix the old shader?
Hi Nil. Thank you for testing! Did you directly compare the dataset performance with the old shader version? Just to make sure it's actually an issue with the clipping planes.
Unfortunately I don't know much about shaders and shader programming. I actually could not find the problem with the old shader. From what I know, it should work. Obviously it does not. I will have to look into it again or find someone who might be more qualified to do that. You don't happen to know someone who knows their way around VTK and shaders?
Yes, I compared both versions of our application; based on MITK 2018.04 and 2021.02. I understand that's it's not a perfect comparison, as there are several other changes between those versions, but it's the best I can do right now.
"Real-time" was an exageration, sorry, but it's still much faster than with clipping planes. With all mappers enabled, there's only a slight delay, maybe 100ms? It's still usable and responsive. With the clipping planes trick, it's around 1s per change, as I wrote.
Unfortunately I don't know much about shaders and shader programming.
I'm sadly in the same situation! My colleagues are either general programmers (like me) or diffusion experts. We have no graphic programmers.
Sorry to ask that kind of questions but ... is there any update on this task?
IIUC, you have an automatic task closing policy and I don't want this task to be closed! It's still the only blocker for us at Imeka for a new MI-Brain release based on MITK 2021.10.