Marching Cubes

Marching Cubes
created: May 2000, updated: November 2001

Using the Open Inventor libraries I created a subclass ofSoEnginefor computing an isosurface usingMarching Cubes: A High Resolution 3D Surface Construction Algorithm, byWilliam Lorensenand Harvey E. Cline. This implementation isVERYdifferent from a previous version posted on this site. This version properly subclasses Open Inventor and efficiently creates an isosurface. The tables provided in the code found atPaul Bourke's pagePolygonising a scalar fieldwere used in this implementation.

The engine takes as input a scalar field and an isovalue. Then as output are the points, normals, and indexes into the points array used to create the triangles. The engine can easily be connected to other Inventor nodes to create anSoIndexedFaceSet. Below is an example of connecting the engine into a scene graph.
// create MarchingCubes object and connect fields
MarchingCubes *mcubes = new MarchingCubes();
mcubes->ref();
mcubes->data.setValue(dims, data);
mcubes->isoValue = 1.0;

// MarchingCubes gives the triangles with the
// vertices ordered clockwise
SoShapeHints *hints = new SoShapeHints();
hints->vertexOrdering.
  setValue(SoShapeHints::CLOCKWISE);
root->addChild(hints);

// connect the MarchingCubes points and
// normals to an SoVertexProperty node
SoVertexProperty *vprop = new SoVertexProperty();
vprop->ref();
vprop->vertex.connectFrom(&mcubes->points);
vprop->normal.connectFrom(&mcubes->normals);

// connect the indexes from MarchingCubes
SoIndexedFaceSet *faceSet = new SoIndexedFaceSet();
faceSet->vertexProperty = vprop;
faceSet->coordIndex.connectFrom(&mcubes->indexes);
root->addChild(faceSet);
Thanks to Gokhan Kisacikoglu, a vertex blending technique was added. The blending is nothing but a simple test to the closest voxel corner based on a percentage from the corner. Below is an example with the blending and without. Also a gif animation showing the blending can be foundhere.

Without Blending

With Blending
The blending reduces the number of triangles of a surface by 40% in some cases. When tested with the MRI data to produce the brain surface, the triangles were reduced from 1,065,244 to 636,702 without loss to the mesh structure. An interactive example of the blending technique can be found by downloading the3D GrapherOpen Inventor application.

TheMarchingCubesengine was used to create all the images on this page. Below are links to the MarchingCubes source code as well as an example which creates a sphere dataset and displays it with the engine node.(TheSFScalarFieldclass is needed by MarchingCubes.)
http://www.wheatchex.com/projects/mcubes/
Marching Cubes算法是一种常用的三维体数据表面重建算法。它可以将一个体数据集转化为连续的多边形网格模型。 在三维体数据中,每个体素的值表示其在某一属性上的特征,如密度、压力等。Marching Cubes算法首先将整个体数据集划分为无数个小立方体,每个小立方体包含8个顶点。然后根据每个小立方体顶点所代表的属性值与事先设定的阈值进行比较,确定该顶点是否在表面上。若在表面上,就将相应顶点连接起来组成一个面,并将该面连接到整个网格模型上。 得到的多边形网格模型可以用于可视化、仿真和分析等应用。Marching Cubes算法具有简单、高效的特点,适用于各种不规则的三维体数据集。它广泛应用于医学图像处理、地质勘探、计算机动画等领域。 然而,Marching Cubes算法也存在一些限制。首先,它在重建过程中产生的多边形可能存在不连续性和拓扑错误。为了解决这个问题,后续研究提出了一些改进算法,如Dual Marching Cubes和Extended Marching Cubes。其次,Marching Cubes算法对数据集的分辨率要求较高,对于过于细致的结构可能无法很好地重建。 总的来说,Marching Cubes算法在三维体数据表面重建领域具有重要的应用价值,其简单、高效的特点使其成为一种常用的算法。随着相关技术的不断发展,对Marching Cubes算法的改进和优化将进一步推动其在各个领域的应用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值