# Labelmap image to polydata via marching cubes code for VTK.js

**URL:** https://discourse.vtk.org/t/labelmap-image-to-polydata-via-marching-cubes-code-for-vtk-js/16239
**Category:** Web
**Created:** [January 16, 2026, 3:39pm UTC](https://discourse.vtk.org/t/labelmap-image-to-polydata-via-marching-cubes-code-for-vtk-js/16239 "2026-01-16T15:39:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![PaulHax](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulhax/32/2748_2.png) [@PaulHax](https://discourse.vtk.org/u/PaulHax)
#### Post date: [January 16, 2026, 3:39pm UTC](https://discourse.vtk.org/t/labelmap-image-to-polydata-via-marching-cubes-code-for-vtk-js/16239/1 "2026-01-16T15:39:31Z")

</div>

I made a small library that generates polydata meshes from labelmaps/segmentations for VTK.js

Demo: [labelmap-polydata Demo](https://paulhax.github.io/labelmap-polydata/)

> **[GitHub - PaulHax/labelmap-polydata: Convert ImageData labelmap to PolyData meshes...](https://github.com/PaulHax/labelmap-polydata)**
>
> Convert ImageData labelmap to PolyData meshes using marching cubes.

Not much to it, but it does have some gotchas worked around for aligning the polydata’s on the background image when the image has a non identiy direction matrix. Enjoy.
