Limit computation only to current slices


I have a 200x200x200 vtk array of 20 components (representing 10 complex numbers).

I need to do a fairly heavy matrix multiplication on each set of 20 components. This needs to happen in real time as the user changes some input parameters with a slider, or moves through the 3 standard slices.

I want to limit the computation only to the visible slices, in order to avoid repeating the computation on the whole volume(which takes too much for real time).

I have an old piece of code that implements this in a custom interface by connecting a custom vtk filter to 3 vtkImageReslices.

I have been searching for the appropriate solution to this for the past week, but I keep struggling to find a suitable one. Any idea would be much appreciated.

Thank you very much

In Slicer’s architecture we call this kind of code a “Displayable Manager” (or MRML Displayable Manager, abbreviated MRMLDM in folder names to keep it short). Probably the transforms is a good place to look for examples. There’s a MRMLDM instance for each view and the MRMLDM code is responsible for mapping what’s in the scene to that particular view given the various view parameters such as slice and pan/zoom. These can be in C++ or Python but typically they are in C++.