Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSc4730/6730 Scientific Visualization

Similar presentations


Presentation on theme: "CSc4730/6730 Scientific Visualization"— Presentation transcript:

1 CSc4730/6730 Scientific Visualization
Lecture 24 Isosurface and Marching Cubes Algorithm Ying Zhu Georgia State University

2 Outline Background Marching cubes algorithm Main reference
William E. Lorensen and Harvey E. Cline, “Marching Cubes: A High Resolution 3D Surface Construction Algorithm”, in Proceedings of ACM SIGGRAPH Conference 1987

3 Information flow for 3D medical algorithms

4 Background One of the main challenge in medical visualization is to visualize the 3D volumetric dataset obtained from computed Tomography (CT), Magnetic Resonance Imaging (MRI), and Single-Photon Emission Computed Tomography (SPECT) A stack of images There are several ways to deal with this problem

5 Background Two types of approaches for 3D medical visualization
Create a 3D surface model from medical images Use volume rendering (without creating a surface model)

6 Background Creating a surface model from medical dataset
Surface from contours Marching cubes algorithm Both methods are used extensively

7 Surface from contours Obtain cross-section images
Manually or automatically mark the boundaries of features or landmarks as contours

8 Surface from contours Manually align the contours according to anatomical landmarks

9 Surface from contours Obtain a sagittal section
Use the sagittal section to guide the alignment

10 Image segmentation and registration toolkit
NLM Insight is an open source segmentation & registration toolkit Segmentation: the process of identifying and classifying data found in medical images. Registration: the task of aligning or developing correspondences between data.

11 Surface from contours Contours are properly aligned

12 Surface from contours Interpolate between contours to obtain the surface model

13 Surface from contours Need large number of brain cross-sections to create a high resolution 3D model Often need to manually edit contours on each cross-section image. Image processing algorithms can be used but their effectiveness depend on the quality of the images Often need to manually align the contours Connect the neighboring contours can be complicated Multiple contours in one slides  how to establish correspondence?

14 Marching Cubes algorithm
Marching Cubes is an algorithm for generating isosurfaces from volumetric data What is an isosurface? What is the isovalue? Users select the desired surface by specifying a density value,

15 Examples of isosurface

16 Marching cube algorithm
What is a marching cube? What is a voxel?

17 The assumption If the density at a pixel exceeds (or equals) the value of the surface (isovalue), then this pixel is inside the surface If the density at a pixel is below the value of the surface (isovalue), then this pixel is outside the surface

18 The basic idea If one or more voxels of a cube have values less than the targeted isovalue, and one or more have values greater than this value, we know the voxel must contribute some component of the isosurface.

19 The basic idea By determining which edges of the cube are intersected by the isosurface, triangular patches can be created which divide the cube between regions within the isosurface and regions outside. By connecting the patches from all cubes on the isosurface boundary, a surface representation is obtained.

20 Triangulated cubes There are two major components of this algorithm.
The first is deciding how to define the section or sections of surface which chop up an individual cube.

21 Triangulated cubes Since there are eight vertices in each cube and two slates, inside and outside, there are only 28 = 256 ways a surface can intersect the cube. By enumerating these 256 cases, we create a table to look up surface-edge intersections, given the labeling of a cubes vertices.

22 Triangulated cubes Two of these are trivial; where all points are inside or outside the cube does not contribute to the isosurface.

23 Triangulated cubes For all other configurations we need to determine where, along each cube edge, the isosurface crosses, and use these edge intersection points to create one or more triangular patches for the isosurface. Triangulating the 256 cases is possible but tedious and error-prone. If you account for symmetries, there are really only 14 unique configurations in the remaining 254 possibilities.

24 Triangulated cubes

25 Triangulated cubes When there is only one corner less than the isovalue, this forms a single triangle which intersects the edges which meet at this corner, with the patch normal facing away from the corner.

26 Triangulated cubes Obviously there are 8 related configurations of this sort. By reversing the normal we get 8 configurations which have 7 corners less than the isovalue. But we don't consider these really unique.

27 Triangulated cubes For configurations with 2 corners less than the isovalue, there are 3 unique configurations, depending on whether the corners belong to the same edge, belong the same face of the cube, or are diagonally positioned relative to each other.

28 Triangulated cubes

29 Triangulated cubes For configurations with 3 corners less than the isovalue there are again 3 unique configurations, depending on whether there are 0, 1, or 2 shared edges (2 shared edges gives you an 'L' shape).

30 Triangulated cubes

31 Triangulated cubes There are 7 unique configurations when you have 4 corners less than the isovalue, depending on whether there are 0, 2, 3 (3 variants on this one), or 4 shared edges.

32 Triangulated cubes

33 Triangulated cubes

34 Case indexing We create an index for each case, based on the state of the vertex. Using the vertex numbering in Figure, the eight bit index contains one bit for each vertex.

35 Case indexing This index serves as a pointer into an edge table that gives all edge intersections for a given cube configuration.

36 Triangulated cubes Each of the non-trivial configurations results in between 1 and 4 triangles being added to the isosurface. Using the index to tell which edge the surface intersects, we can interpolate the surface intersection along the edge.

37 Isosurface construction
Now that we can create surface patches for a single voxel, we can apply this process to the entire volume. We can process the volume in slabs, where each slab is comprised of 2 slices of pixels.

38 Isosurface construction

39 Isosurface construction
We can either treat each cube independently, or we can propogate edge intersections between cubes which share the edges. This sharing can also be done between adjacent slabs, which increases storage and complexity a bit, but saves in computation time. The sharing of edge/vertex information also results in a more compact model, and one that is more amenable to interpolated shading.

40 Calculating normals The final step in marching cubes calculates a unit normal for each triangle vertex. The rendering algorithms use this normal to produce Gouraud-shaded images.

41 Summary of marching cubes
Marching cubes creates a surface from a three-dimensional set of data as follows: 1. Read four slices into memory. 2. Scan two slices and create a cube from four neighbors on one slice and four neighbors on the next slice. 3. Calculate an index for the cube by comparing the eight density values at the cube vertices with the surface constant.

42 Summary of marching cubes
4. Using the index, look up the list of edges from a pre-calculated table. 5. Using the densities at each edge vertex, find the surface edge intersection via linear interpolation. 6. Calculate a unit normal at each cube vertex using central differences. Interpolate the normal to each triangle vertex. 7. Output the triangle vertices and vertex normals.

43 Discussion One obvious problem with marching cubes is the amount of memory needed to store the resulting surface. As each boundary cube can generate up to 4 sub-pixel facets, the result is quite large. We can reduce this somewhat by sharing vertices and edges, or even merging coplanar patches into larger facets. Another solution might be to try and fit parametric surfaces to groups of boundary points, though this may be difficult for complex surface geometries.

44 Discussion Another problem arises when you don't have a filled space of voxels. Depending on how the volume data was acquired there may be voids which need to be assigned values or circumnavigated in the surface generation algorithm. Any interpolated value used may reduce the validity of the resulting surface. A final alternate strategy would be to ray trace the original volume data.


Download ppt "CSc4730/6730 Scientific Visualization"

Similar presentations


Ads by Google