I would like to implement an interactive way to adjust the isovalue of an isosurface rendered with the 'patch' function without having to call 'isosurface()' every time. I would like to re-render the volume almost instantly like the volumeViewer app.
This is demonstrated in MATLAB's volumeViewer app. The user can adjust the isovalue with a slider and the volume is rendered almost instantly with the new isovalue.
I am using a Marching Cubes function similar to 'isosurface()' to generate the faces and vertices of the 3D volume, both require an isovalue as an input. This function takes 10-15 seconds for a matrix 280x280x1000, therefor if I would like to view the volume with a new isovalue I have to wait for the Marching Cubes function to generate the new faces and vertices.
iso = 3;
[X,Y,Z] = meshgrid(1:size(img,2),1:size(img,1),1:size(img,3));
[F,V] = MarchingCubes(X,Y,Z,img,iso);
patch('Faces',F','Vertices',V,'EdgeColor','none','FaceColor',[1 0 0],'FaceLighting','gouraud','FaceAlpha',.75)