How to get GPU texture id(or handle) or texture buffer?

I loaded sample data and displayed volume in 3D view.
Now I need to get texture buffer of this volume to do some process.
Is there a method to get GPU texture buffer or texture id?

When you load a volume into the scene, it is stored into CPU memory only.

Individual reformatted slices are uploaded to GPU (when you display the volume in slice views).

The entire volume is uploaded to the GPU if you display it using GPU volume rendering. You can run custom GLSL shaders on it (see Slicer Prism extension), but I am not sure if you can get access to the buffer (check out VTK and the Volume Rendering module for details).

What is your overall goal?

Operating system: Windows 10
Slicer version: 4.11

I loaded the sample data and displayed the volume in 3D view by choosing “VTK GPU Ray Casting”.

Now I need to get texture id or texture buffer to do other process.
Is there a way to get it?

Let us know what you want to achieve and then we can give further guidance.

Thanks for reply.

We have a c++ library that performs image processing on textures.
So I need texture buffer (or id or handle) as input parameter.

This is a challenge because VTK manages the OpenGL state to support a wide range of visualization options so you’ll need to study that code carefully to integrate it. I had some prototypes working with earlier versions of VTK but haven’t tried with vtk 9 that Slicer currently uses. It would be helpful to have a formula for this kind of operation, so if you make progress please share back some documentation or example code. Starting with SlicerPrism as Andras suggested may get you started.

I don’t think you can implement processing on the GPU in C++.

If it is really C++ then it runs on the CPU and you don’t need to transfer the image to the GPU.

If the library is actually in GLSL then PRISM or the GPU image processing filter in vtkAddon are good examples.

If the library uses OpenCL then you can find examples for how to create a processing filter from it in ITK.

If you have Cuda code then I would recommend to port it to GLSL or OpenCL for compatibility with non-NVidia hardware, but if I remember well there are some Cuda examples in the VASST extension.

Thanks for suggestion. I’ll look into Slicer Prism extension.

Yes, the library uses OpenCL.
Thanks for suggestion.