Im2mesh (2D image to finite element mesh)

버전 2.26 (15.1 MB) 작성자: Jiexian Ma
Generate finite element mesh based on 2D multi-phase image. For image-based finite element analysis.
다운로드 수: 1.4K
업데이트 날짜: 2025/3/17
GUI version of Im2mesh is now available: Im2mesh_GUI
Please check the tutorial: Im2mesh_GUI Tutorial.pdf
Im2mesh is an open-source MATLAB/Octave package for generating finite element mesh based on 2D segmented multi-phase 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 can also be used as a mesh generation interface for MATLAB multi-part geometry.
News
  • Version 2.26 can export mesh as msh file (Gmsh mesh format).
  • Version 2.2.1 can edit polygonal boundary before mesh generation.
  • Version 2.2.0 supports using Gmsh as mesh generator (unstructured quadrilateral mesh).
  • Version 2.1.6 updates the DOI. Im2mesh is now citable.
Features
  • Accurately preserve the contact details between different phases.
  • Incorporates polyline smoothing and simplification
  • Able to avoid sharp corners when simplifying polylines.
  • Support phase selection before meshing.
  • 4 mesh generators are available for selection: MESH2D, generateMesh, Gmsh, and pixelMesh.
  • Generated mesh can be exported as inp file (Abaqus), bdf file (Nastran bulk data, compatible with COMSOL), msh file (Gmsh mesh format), and MATLAB PDE model object.
  • Mesh can also be exported as many other formats via Gmsh, such as stl and vtk.
  • Graphical user interface (GUI) version is available as a MATLAB app.
How to start
After downloading Im2mesh package, I suggest you start with Im2mesh_GUI app in the folder, which will help you understand the workflow and parameters of Im2mesh. A detailed tutorial is provided in Im2mesh_GUI Tutorial.pdf.
Then, you can learn to use Im2mesh package in the folder "Im2mesh_Matlab" or "Im2mesh_Octave". 16 examples are provided.
  • If you're using MATLAB, examples are live script mlx files (demo1.mlx ~ demo16.mlx). If you find some text in the mlx file is missing, please read the html file instead. Note that demo02.mlx requires MATLAB Partial Differential Equation (PDE) Toolbox. If you don't have PDE Toolbox, you can skip demo02.mlx.
  • If you're using Octave, examples are m files (demo1.m ~ demo10.m).
  • Examples are also available as html files in the folder "demo_html".
Examples
  • demo01 - Demonstrate function im2mesh, which use MESH2D as mesh generator.
  • demo02 - Demonstrate function im2meshBuiltIn, which use MATLAB built-in function generateMesh as mesh generator.
  • demo03 - How to export mesh as inp, bdf, msh, and node/ele file
  • demo04 - What is inside function im2mesh.
  • demo05 - Parameter tf_avoid_sharp_corner
  • demo06 - Thresholds in polyline smoothing
  • demo07 - Parameter grad_limit for mesh generation
  • demo08 - Parameter hmax for mesh generation
  • demo09 - How to select phases for meshing
  • demo10 - Different polyline smoothing techniques
  • demo11 - How to find node sets at the interface and boundary
  • demo12 - Demonstrate function pixelMesh (pixel-based quadrilateral mesh)
  • demo13 - How to use Gmsh as mesh generator
  • demo14 - How to use polyshape object to define geometry for mesh generation
  • demo15 - How to edit polygonal boundaries before meshing
  • demo16 - How to add points or nodes to polygonal boundaries before meshing
Notes
Im2mesh package identifies different phases in a image by their grayscales. Different grayscales correspond to different phases. If you have 4 level of grayscales in a image, the resulted meshes will contain 4 phases.
If you have any questions or suggestions, feel free to send me an email.
Jiexian Ma, Jan 2025. mjx0799@gmail.com
Acknowledgments
Many thanks to Dr. Yang Lu for providing valuable suggestions and testing of export formats.
This project incorporates code from the following open-source projects. I appreciate the contributions of the original authors. Each incorporated code retains its original copyright.

인용 양식

If you use Im2mesh package or Im2mesh_GUI, please cite it as follows.

Ma, Jiexian, and Yuanyuan Li. Im2mesh: A MATLAB/Octave Package for Generating Finite Element Mesh Based on 2D Multi-Phase Image. Zenodo, 2025, https://doi.org/10.5281/ZENODO.14847059.

양식 더 보기

Once my paper is published, I will update a new DOI here.

MATLAB 릴리스 호환 정보
개발 환경: R2021b
R2017b 이상 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Im2mesh_Matlab

Im2mesh_Matlab/mesh2d-master

Im2mesh_Matlab/mesh2d-master/aabb-tree

Im2mesh_Matlab/mesh2d-master/geom-util

Im2mesh_Matlab/mesh2d-master/hfun-util

Im2mesh_Matlab/mesh2d-master/hjac-util

Im2mesh_Matlab/mesh2d-master/mesh-ball

Im2mesh_Matlab/mesh2d-master/mesh-cost

Im2mesh_Matlab/mesh2d-master/mesh-file

Im2mesh_Matlab/mesh2d-master/mesh-util

Im2mesh_Matlab/mesh2d-master/poly-test

Im2mesh_Matlab/test_script

Im2mesh_Octave

Im2mesh_Octave/mesh2d-master

Im2mesh_Octave/mesh2d-master/aabb-tree

Im2mesh_Octave/mesh2d-master/geom-util

Im2mesh_Octave/mesh2d-master/hfun-util

Im2mesh_Octave/mesh2d-master/hjac-util

Im2mesh_Octave/mesh2d-master/mesh-ball

Im2mesh_Octave/mesh2d-master/mesh-cost

Im2mesh_Octave/mesh2d-master/mesh-file

Im2mesh_Octave/mesh2d-master/mesh-util

Im2mesh_Octave/mesh2d-master/poly-test

버전 게시됨 릴리스 정보
2.26

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/v2.26

2.2.3

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/v2.2.3

2.2.1

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.2.1

2.2.0

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.2.0

2.1.9

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.1.9

2.1.8

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.1.8

2.1.6

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.1.6

2.1.5

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.1.5

2.1.1

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.1.1

2.1.0

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.1.0

1.88

Update Description

1.87

Update Description

1.86

add note

1.85

Add comments & description

1.84

Revise Description

1.83

Revise summary

1.82

Update description

1.81

Update description

1.80

Add im2meshBuiltIn.m, poly2meshBuiltIn.m
Update examples

1.76

improve getCtrlPnts
faster

1.75

Add new parameter 'select_phase'

1.71

Revise description

1.7

Add two new parameters for mesh generation

1.6

make im2Bounds() more readable using getExactBounds()

1.5

improve im2Bounds.m and getCtrlPnts.m
significantly faster

1.1.1

update description

1.1

revise demo(), add examples
add several functions, like printInp_multiPart(), printInp_multiSect(), printBdf()

0.9

Improve time efficiency of getCtrlPnts(). Faster. Add new parameter - tf_avoid_sharp_corner. Able to avoid non-convergence when meshing.
Rewrite getNodeEle(). Using global numbering.
Revise printInp(). Add new parameter - precision_nodecoor.

0.8.2

new image for cover

0.8.1

revise getCtrlPnts() for time efficiency

0.8.0

debug
revise printInp(), support linear element and quadratic element
revise im2Bounds() and bwperimtrace(), for 4-connected neighbourhood
able to clear up redundant vertices that are brought about by delZeroAreaPoly

0.7.0

debug
reorganize part of the code, increase readability
revise some comments
add calculation of polygon's area, polygon with zero area will be deleted automatically
update examples

0.6.2

update description

0.6.1

update description

0.6.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.