Adjusting isovalue for patch interactively without having to use isosurface() every time?

2 views (last 30 days)
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.
%Normal flow of events
iso = 3; %initial isovalue
[X,Y,Z] = meshgrid(1:size(img,2),1:size(img,1),1:size(img,3));
[F,V] = MarchingCubes(X,Y,Z,img,iso); %Calculate faces and vertices of 3D volume. Can also use isosurface(X,Y,Z,img,iso)
patch('Faces',F','Vertices',V,'EdgeColor','none','FaceColor',[1 0 0],'FaceLighting','gouraud','FaceAlpha',.75) %View the 3D volume by patching faces and vertices together

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!