GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • FAST | Documentation
  • Get started
  • Install FAST
  • C++ Introduction Tutorial
  • Python Introduction Tutorial
  • Text Pipelines
  • Learn FAST
  • C++ Tutorials
  • C++ Examples
  • Python Tutorials
  • Python Examples
  • API Reference
  • API Index
  • Building FAST

This view

  • Original page
  • New address

GeezerVison is showing fast-imaging.github.io — extract_surface_mesh.py source | FAST | Documentation

extract_surface_mesh.py source

This examples extract a surface mesh with over 3 million triangles from a CT volume using the Marching Cubes algorithm.

This examples extract a surface mesh with over 3 million triangles from a CT volume using the Marching Cubes algorithm. It also shows how you can access the vertex and triangle data directly.

Image
import fast

importer = fast.ImageFileImporter.create(fast.Config.getTestDataPath() + "/CT/CT-Abdomen.mhd")

extraction = fast.SurfaceExtraction.create(threshold=300).connect(importer)

mesh = extraction.runAndGetOutputData()
access = mesh.getMeshAccess(fast.ACCESS_READ)

# Get size of mesh:
print('Mesh size (vertices, triangles)', mesh.getNrOfVertices(), mesh.getNrOfTriangles())
# Get the position of first vertex
print(access.getVertex(0).getPosition())
# Get endpoints (vertex indices) of triangle 0
print(access.getTriangle(0).getEndpoint1(), access.getTriangle(0).getEndpoint2(), access.getTriangle(0).getEndpoint3())

# Get all vertices and triangles as lists, this is slow if it is a big surface:
#vertices = access.getVertices()
#triangles = access.getTriangles()

# Visualize the mesh
renderer = fast.TriangleRenderer.create().connect(mesh)

window = fast.SimpleWindow3D.create().connect(renderer).run()
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.