alvin-yang68 / Marching-Cubes

Implementation of the Marching Cubes algorithm on Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Marching Cubes Implementation

Marching Cubes is an algorithm for extracting a polygonal mesh of an isosurface from a 3D scalar field. It was originally developed for efficient visualization of data from CT and MRI devices.

In this project, the Marching Cubes algorithm was implemented on Python in Jupyter notebook. It is a function that takes a volumetric data and an isovalue as inputs. The volumetric data is a 3D uniform grid where each vertex of the voxels has a scalar value associated with it. The function would then output the isosurface mesh in the indexed face set data structure (OBJ file format). Various optimizations are also done. Notably, the result of linear interpolation on each bipolar edge is stored in a lookup table so that it does not need to be recomputed every time it is being processed. We also ensured the generation process of the isosurface mesh in the form of indexed face set data structure has a linear run time complexity by integrating the process inside the Marching Cubes algorithm. Finally, the isosurface mesh is converted into UnstructuredGrid object by using pyvista and then rendered using itkwidget to allow the viewer to interact with the visualization. We then applied the function on several example data sets and compared them with those outputted by the marching_cubes_lewiner from skimage library. It was found the isosurface meshes generated by our implementation and the library version were equivalent.

About

Implementation of the Marching Cubes algorithm on Python.


Languages

Language:Jupyter Notebook 100.0%