{"id":24912328,"url":"https://github.com/mjx888/im2mesh","last_synced_at":"2026-06-14T01:06:18.053Z","repository":{"id":275319757,"uuid":"924134594","full_name":"mjx888/im2mesh","owner":"mjx888","description":"Im2mesh is a MATLAB/Octave package for generating finite element mesh based on 2D or 3D multi-phase segmented image. ","archived":false,"fork":false,"pushed_at":"2026-06-11T21:39:36.000Z","size":217426,"stargazers_count":14,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-11T22:20:56.742Z","etag":null,"topics":["2d","3d","finite-element-analysis","finite-element-mesh","gmsh","image","matlab","mesh","microstructure","octave","polygon","polylines"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mjx888.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-29T13:32:46.000Z","updated_at":"2026-06-11T21:48:02.000Z","dependencies_parsed_at":"2025-02-15T21:20:35.219Z","dependency_job_id":"d7bde205-3789-430c-8c9a-b7c44dbeb665","html_url":"https://github.com/mjx888/im2mesh","commit_stats":null,"previous_names":["mjx888/im2mesh"],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/mjx888/im2mesh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjx888%2Fim2mesh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjx888%2Fim2mesh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjx888%2Fim2mesh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjx888%2Fim2mesh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjx888","download_url":"https://codeload.github.com/mjx888/im2mesh/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjx888%2Fim2mesh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34305789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2d","3d","finite-element-analysis","finite-element-mesh","gmsh","image","matlab","mesh","microstructure","octave","polygon","polylines"],"created_at":"2025-02-02T05:19:15.512Z","updated_at":"2026-06-14T01:06:18.046Z","avatar_url":"https://github.com/mjx888.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Im2mesh (2D or 3D image to finite element mesh)\n\n\n\n**Im2mesh** is an open-source MATLAB/Octave package for generating finite element mesh based on 2D or 3D multi-phase segmented image. It provides a robust workflow capable of processing various input images, such as microstructure images of engineering materials. Due to its generalized framework, Im2mesh can handle segmented image with more than 10 phases.  Im2mesh was originally released on [MathWorks File Exchange](https://www.mathworks.com/matlabcentral/fileexchange/71772-im2mesh-2d-image-to-finite-element-mesh) in 2019. \n\nIm2mesh can also be used as a mesh generation interface for MATLAB 2D multi-part geometry, aka multi-domain or multi-phase geometry (see demo12-18).\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src = \"https://mjx888.github.io/im2mesh_demo_html/cover_2602.jpg\" height=\"220\"\u003e \n\u003c/p\u003e\n\n\n**Downloads:**\n\n- [Im2mesh package](https://github.com/mjx888/im2mesh/releases)\n- [GUI version](https://mjx888.github.io/others/Im2mesh_GUI.mlappinstall) (MATLAB app)\n- [GUI version](https://mjx888.github.io/others/Installer_Im2mesh_GUI.zip) (standalone desktop application \u0026 no need to install MATLAB)\n\n\n\n**News:**\n\n- Version 2.60 can generate tetrahedral mesh based on 3D voxel image! See [demo20](https://mjx888.github.io/im2mesh_demo_html/demo20.html).\n- Version 2.45 can export image boundaries as `dxf` file (CAD).\n- Version 2.2.0 can use Gmsh as mesh generator (quadrilateral mesh).\n\n\n\n**Features (for 2d):**\n\n- Accurately preserve the contact details between different phases. \n- Incorporates polyline smoothing and simplification\n- Able to edit polygonal boundary before mesh generation.\n- Support phase selection and local mesh refinement.\n- 4 mesh generators are available for selection: [MESH2D](https://github.com/dengwirda/mesh2d), [generateMesh](https://www.mathworks.com/help/pde/ug/pde.pdemodel.generatemesh.html), [Gmsh](https://gmsh.info/), and pixelMesh.\n- Graphical user interface (GUI) version is available as a MATLAB app and as a standalone desktop application.\n\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src = \"https://mjx888.github.io/im2mesh_demo_html/GUI.png\" height=\"300\"\u003e \n\u003c/p\u003e\n\n\n\n**Generated mesh can be exported as:** \n\n- `inp` file with boundary node set (Abaqus)\n- `bdf` file (Nastran bulk data, compatible with COMSOL)\n- `msh` file (Gmsh mesh format)\n- `stl` file\n- For other formats, you can import the generated `msh` file into software Gmsh and then export.\n\n\n\n## Dependencies\n\n- When running demo02 and demo18 in Im2mesh package, you need to install MATLAB Partial Differential Equation Toolbox. For other demos, no need to install any MATLAB toolboxes.\n- When running demo20 in Im2mesh package, you need to install fTetWild. \n- When using Im2mesh_GUI as a standalone desktop application, there is no need to install MATLAB or any MATLAB toolboxes. \n\n\n\n## Version compatibility\n\n- Im2mesh_GUI: MATLAB R2017b or later; version higher than R2018b is preferred.\n- Im2mesh package: MATLAB R2017b or later. GNU Octave 9.3.0 or later.\n- Gmsh: tested with version 4.13 and 4.14.\n\n\n\n\n## How to start\n\nAfter downloading Im2mesh package, I suggest you start with [Im2mesh_GUI app](https://github.com/mjx888/im2mesh/tree/main/Im2mesh_GUI%20app) in the folder, which will help you understand the workflow and parameters of Im2mesh. A detailed tutorial is provided in [Im2mesh_GUI Tutorial.pdf](https://github.com/mjx888/im2mesh/blob/main/Im2mesh_GUI%20Tutorial.pdf). **Note that Im2mesh_GUI is for 2D images.** \n\nThen, you can learn to use Im2mesh package in the folder \"Im2mesh_Matlab\" or \"Im2mesh_Octave\". 20 examples are provided. demo01-18 are for 2D images. demo19-20 are for 3D voxel images.\n\n- If you're using MATLAB,  examples are live script `mlx` files (`demo01.mlx` ~ `demo20.mlx`). If you find some text in the `mlx` file is missing, please read the `html` file instead.\n- If you're using Octave,  examples are `m` files (`demo01.m` ~ `demo10.m`).\n- Examples are also available as `html` files in the folder \"demo_html\".\n- You can skip demo04 and demo09. These demos are kept for historical reason.\n- If you're only interested in 3D voxel images, you can skip demo01-18.\n\n**Examples:**\n\n- [demo01](https://mjx888.github.io/im2mesh_demo_html/demo01.html) - Demonstrate function `im2mesh`, which use `MESH2D` as mesh generator.\n- [demo02](https://mjx888.github.io/im2mesh_demo_html/demo02.html) - Demonstrate function `im2meshBuiltIn`, which use MATLAB built-in function `generateMesh` as mesh generator.\n- [demo03](https://mjx888.github.io/im2mesh_demo_html/demo03.html) - Export: save mesh as `inp`, `bdf`, `msh` or, `stl` file; save image boundary as `dxf` file, Gmsh `geo` file, or PSLG data.\n- [demo04](https://mjx888.github.io/im2mesh_demo_html/demo04.html) - What is inside function `im2mesh`\n- [demo05](https://mjx888.github.io/im2mesh_demo_html/demo05.html) - Thresholds in polyline smoothing\n- [demo06](https://mjx888.github.io/im2mesh_demo_html/demo06.html) - Parameter `hmax` and `grad_limit` in mesh generation\n- [demo07](https://mjx888.github.io/im2mesh_demo_html/demo07.html) - Function `plotMeshes`\n- [demo08](https://mjx888.github.io/im2mesh_demo_html/demo08.html) - Select phases for meshing\n- [demo09](https://mjx888.github.io/im2mesh_demo_html/demo09.html) - Find node sets at the interface and boundary\n- [demo10](https://mjx888.github.io/im2mesh_demo_html/demo10.html) - Function `pixelMesh` (pixel-based quadrilateral mesh)\n- [demo11](https://mjx888.github.io/im2mesh_demo_html/demo11.html) - Use `Gmsh` as mesh generator\n- [demo12](https://mjx888.github.io/im2mesh_demo_html/demo12.html) - Use polyshape to define geometry\n- [demo13](https://mjx888.github.io/im2mesh_demo_html/demo13.html) - 2D mesh for periodic boundary conditions\n- [demo14](https://mjx888.github.io/im2mesh_demo_html/demo14.html) - Edit polygonal boundaries before meshing\n- [demo15](https://mjx888.github.io/im2mesh_demo_html/demo15.html) - Generate mesh based on 2D contours\n- [demo16](https://mjx888.github.io/im2mesh_demo_html/demo16.html) - Add mesh seeds/nodes\n- [demo17](https://mjx888.github.io/im2mesh_demo_html/demo17.html) - Refine mesh\n- [demo18](https://mjx888.github.io/im2mesh_demo_html/demo18.html) - 2D image to tetrahedral mesh\n- [demo19](https://mjx888.github.io/im2mesh_demo_html/demo19.html) - Function `voxelMesh` (voxel-based hexahedral mesh)\n- [demo20](https://mjx888.github.io/im2mesh_demo_html/demo20.html) - 3D voxel image to tetrahedral mesh (via fTetWild)\n\n\n\n## Author\n\nJiexian Ma\n\n## Cite as\n\nIf you use Im2mesh, please cite it as follows. You can click the DOI link below to see other citation styles.\n\nMa, J., \u0026 Li, Y. (2025). Im2mesh: A MATLAB/Octave package for generating finite element mesh based on 2D multi-phase image (2.1.5). Zenodo. https://doi.org/10.5281/zenodo.14847059\n\nOnce my paper is published, I will update a new DOI here.\n\n## Acknowledgments\n\nMany thanks to Dr. Yang Lu for providing valuable suggestions and testing of export formats. \n\nThis project incorporates code from the following open-source projects. I appreciate the contributions of the original authors. Each incorporated code retains its original copyright.\n\n- [MESH2D](https://github.com/dengwirda/mesh2d) by Darren Engwirda\n- [dpsimplify](https://www.mathworks.com/matlabcentral/fileexchange/21132-line-simplification) by Wolfgang Schwanghart\n- [p_poly_dist](https://www.mathworks.com/matlabcentral/fileexchange/12744-distance-from-points-to-polyline-or-polygon) by Michael Yoshpe\n- [MeshQualityQuads](https://www.mathworks.com/matlabcentral/fileexchange/33108-unstructured-quadrilateral-mesh-quality-assessment) by Allan Peter Engsig-Karup\n- [XtalMesh](https://github.com/jonathanhestroffer/XtalMesh) by Jonathan Hestroffer\n\n\n\n## Other related projects\n\n- [writeMesh (write mesh to inp, bdf, and msh files)](https://github.com/mjx888/writeMesh)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjx888%2Fim2mesh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjx888%2Fim2mesh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjx888%2Fim2mesh/lists"}