Limit computation only to current slices

Hello,

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++.

1 Like

Thank you, I read what I found about MRMLDM and tried at first to parse through the Transforms code, but honestly, it was too difficult for me to reverse engineer how MRMLDM code is applied in practice.

I ended up rethinking this problem in a different way and made it work.

For future works, is there anywhere else where I could look into a simpler applications of MRMLDM?

Thank you very much

There are 6 MRMLDM directories in the Slicer core code, and many more in extensions. I’m not sure what is the best to look at. Maybe someone who’s developed one recently can make a suggestion?

I agree that displayable managers can be quite complex, so I think your method of updating only the visible parts of a volume for quick preview is a good approach.