File Exchange

image thumbnail


version 1.9.0 (33.8 MB) by Qianqian Fang
Iso2Mesh - a 3D surface and volumetric mesh generator for MATLAB/Octave


Updated 21 Feb 2021

From GitHub

View license on GitHub

Iso2Mesh is a MATLAB/Octave-based mesh generation toolbox, designed for easy creation of high quality surface and tetrahedral meshes from 3D volumetric images. It contains a rich set of mesh processing scripts/programs, working either independently or interacting with external free meshing utilities. Iso2Mesh toolbox can directly convert a 3D image stack, including binary, segmented or gray-scale images such as MRI or CT scans, into quality volumetric meshes. This makes it particularly suitable for multi-modality medical imaging data analysis and multi-physics modeling. Above all, Iso2Mesh is open-source. You can download it for free. You are also allowed to extend the toolbox for your own research and share with other users. Iso2Mesh is cross-platform and is compatible with both MATLAB and GNU Octave.

Cite As

Qianqian Fang (2021). Iso2Mesh (, GitHub. Retrieved .

Comments and Ratings (14)

Aurélien Sibellas

Exactly what I was looking for...and it perfectly works with my 3D binary images.

Cenk Karaman


There is a problem with several isosurfaces, maybe due to the change in fgets and fgetl in MATLAB starting with R2019b. See below:
Error using fgets
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in fgetl (line 32)
[tline,lt] = fgets(fid);

Error in readoff (line 23)

Error in vol2restrictedtri (line 54)

Error in vol2surf (line 172)

Error in vol2mesh (line 63)

Jin Yang

Really good code and super helpful! If there would be a manual document for some demos that will be better!


Hi, I got an error in meshresample.m:
The was found (136MB), but after the command, was not generated. Is this because the mesh is too complicated?

"F:\mCatch\mcrCache9.0.1\RMD_re1\src\bin\cgalsimp2.exe" "C:\Users\Jiang\AppData\Local\Temp\iso2mesh-Jiang\" 0.5 "C:\Users\Jiang\AppData\Local\Temp\iso2mesh-Jiang\"

Qianqian Fang

Umar, if you call v2m/vol2mesh with the cgalmesh method option, the regions are automatically labeled based on the voxel label. If you call s2m/surf2mesh using tetgen, you will need to provide seed points for each region, given as the "regions" parameter. Then, tetgen will label the regions according to the index in the seed array.

if these does not solve the problem, please send your sample script and a small data to our mailing list!forum/iso2mesh-users

Umar Hossain

Hi Qianqian,

I'm having issues meshing a volume that as far as I can tell, has been labelled correctly with multiple regions. The brain meshing demo works fine, but my volume doesn't, the 5th elem column always returns everything belonging to the same region.

To label the regions, I'm numbering their voxel value in the 3D double array from 1 --> however many regions I want. Is this correct?


Sascha Schlechtweg

Nice Toolbox, but why do i get the following error running demo_surf2mesh_ex1.m: Error using meshresample>domeshsimplify (line 48)
cgalsimp2 command failed
I added all paths to the Matlab search path as well as the bin path.
I'm running the toolbox under MacOS 10.14; Maltab R2018a

Can somebody help me?
Thanks a lot!

J Budd

This is a useful toolbox but I too found the same quirk mentioned by Brandon. For example, to export volume mesh as STL

load rat_head.mat
clear opt


causes 'error: horizontal dimensions mismatch (4x2 vs 3x1)'. But


produces STL output which can be viewed, e.g. online STL viewer such as

Brandon Patterson

Iso2mesh is fairly powerful and simple to use. I have used it successfully to build FE meshes from 3D images generated from histological slide scans, so that I can put their geometries into comsol. Overall, I like and recommend this package, but it definitely has some bugs that need fixing (examples below).

Unfortunately, this program's most powerful 3D meshing tool 'cgalmesh' has some weird errors that aren't easily diagnosable. A common example of this is that when running vol2mesh on a large or complex mesh, cgalmesh.exe will sometimes fail to create out an output file 'post_cgalmesh.mesh', crashing the whole meshing process.

Another quirk of this program is that the node outputs of vol2mesh are of the wrong dimensions to use the built-in savemsh.m savestl.m, etc... functions. It's a fairly easy fix to remove the last column of the node, but this is just an example of the kind of bugs that exist with the current version.

Brandon Patterson

Qianqian Fang

I would like to invite you to test a new GUI based meshing interface (i2m), integrating all iso2mesh functionalities. A preview version of i2m (or img2mesh) was committed to the github repository, which you can download directly by using the "Download" button on the top-right of this page.

Two screenshots of the meshing GUI can be found in this mailing list announcement!topic/iso2mesh-users/mZeURNzuWI8

The GUI is designed to be very flexible, and currently supports loading various volumetric image (.nii, .img, .inr, .mat) and mesh (.medit, .off, .json ...) formats. You can also export data in JSON format (*.jmesh). Use main and context menus to create data, and build a meshing work-flow. A standalone executable of i2m containing most iso2mesh features is also coming along.

To use i2m, simply unzip the downloaded package, open matlab, and type "i2m". Currently, i2m only supports matlab 2015a or newer.

I'd love to hear what you think. Please file bugs at the github issues page at


Qianqian Fang

Iso2Mesh 1.9.0-1 is released, fixing an executable path bug reported in Issue #21.

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!