I am trying to implement a feature where the slicing axis can be changed in real time. I have made a proof of concept using the by using the vtkImageReslice, where I use ResliceAxes to change the rotation of the different axis (Add the source to the vtkImageReslice and have it output a 3D volume, add the output of the vtkImageReslice to a vtkImageMapper, and slice the mapper). It works as expected, but the performance is really slow in realtime.
Are there ways to improve this? Do you have other solutions in mind?
There are some fairly simple things that might speed up the execution.
Call this.filter.update() on vtkImageReslice. This should ensure that it updates the whole volume exactly once. If you don’t do this, then every time that the mapper shows a different slice, it will re-execute vtkImageReslice for that slice.
It will also help if you keep a separate vtkImageReslice for each direction, so that it isn’t necessary to re-execute the reslice when you want to switch from one direction to another. But if this isn’t possible, then make sure to call update() on vtkImageReslice after you change directions.
Or, you can use vtkImageResliceMapper instead of vtkImageReslice and vtkImageMapper.
And would you then have a vtkImageReslice instance for the three orthogonal axes? Scrolling on a plane would then involve updating the resliceAxis for the vtImageReslice instance of the corresponding plane?