Skip to content

artorg-unibe-ch/spline_mesher

Repository files navigation

DOI

Python application Documentation

Spline-based structured conformal hexahedral meshing

A Python package for generating GMSH meshes from SCANCO HR-pQCT images.
Explore the docs »

View Demo · Report Bug · Request Feature

👷🏼 Simone Poncioni
🦴 Musculoskeletal Biomechanics Group
🎓 ARTORG Center for Biomedical Engineering Research, University of Bern

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Spline-mesher01 Spline-mesher02

Import a voxel-based model and convert it to a geometrical simplified representation through the use of splines for each slice in the transverse plane.

(back to top)

Built With

Python GMSH

(back to top)

📝 Introduction

A Python package for generating GMSH meshes from SCANCO HR-pQCT images. Import a voxel-based model and convert it to a geometrical simplified representation through the use of splines for each slice in the transverse plane.

(back to top)

💡 Method

  • Structured Mesh: Provides greater simplicity, efficiency, and lower memory usage due to implicit connectivity with neighboring elements. Ensures topologically identical models for easy comparison between patients or across longitudinal studies.
  • Contour Extraction & Smoothing: Utilizes scikit-image for periosteal and endosteal contour extraction, followed by Douglas-Ramer-Peucker simplification and 3rd order periodic BSplines for smooth geometry representation.
  • Sanity Check: Ensures a minimum cortical thickness of 0.5 mm, allowing space for at least three elements and continuity in thin structures.
  • Mesh Generation: The simplified geometry is imported into GMSH via the OpenCASCADE kernel. Transfinite techniques and the Winslow untangler are used for optimal mesh quality.
  • Quality Assessment: Mesh quality is evaluated using the Dice similarity coefficient (DSC) with a minimum value of 95%, and the (signed-) inverse conditioning number ((S-) ICN) to ensure matrix conditioning and simulation stability.

For more examples, please refer to the Documentation

(back to top)

Getting Started

To get a local copy up and running follow these simple example steps.

🔧 Installation

  1. Clone the repo

    git clone https://github.com/artorg-unibe-ch/spline_mesher.git
  2. Install dependencies

    conda create -n meshenv python=3.9 --file requirements.txt
    conda activate meshenv
    python setup.py build_ext --inplace
    python setup.py install
  3. For developers: install the package in editable mode and install requirements for testing

    pip install -e .
    pip install -r requirements-dev.txt

(back to top)

🛣️ Roadmap

  • v0.0.1: single execution of radius and tibia mesher
  • v0.0.2:
    • Faster implementation of sorting algorithm
    • Faster implementation of cortical sanity check
    • Implement test robustness over different models
  • v1.1.0: add phase discrimination in order to mesh single phase models (e.g. vertebrae)

See the open issues for a full list of proposed features (and known issues).

(back to top)

🤝 Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

📜 License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

📧 Contact

Simone Poncioni - simone.poncioni@unibe.ch

(back to top)

🙏 Acknowledgements

This work was funded internally by the ARTORG Center for Biomedical Engineering Research and by the Department of Osteoporosis of the University of Bern. Calculations were performed on UBELIX, the HPC cluster at the University of Bern.