Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

Use automesh from one of the following interfaces:

  • command line interface,
  • Rust interface, or
  • Python interface.

All interfaces are independent from each other:

  • The Rust interfaces can be used without the Python interface.
  • The Python interface can be used without the Rust interfaces.

For macOS and Linux, use a terminal. For Windows, use a Command Prompt (CMD) or PowerShell.

Step 1: Install Prerequisites

  • The command line interface and Rust interface depend on Rust and Cargo.
    • Cargo is the Rust package manager.
    • Cargo is included with the Rust installation.
  • The Python interface depends on Python and pip.
    • pip is the Python package installer.
    • pip is included with the standard installation of Python starting from Python 3.4.

Rust Prerequisites

Install Rust and Cargo for your operating system:

macOS and Linux

  1. Open a terminal. Install Rust using rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  1. Follow the on-screen instructions to complete the installation.
  2. Add Cargo's bin directory to your PATH:
source $HOME/.cargo/env

Windows

  1. Download rustup-init.exe from run the Rust installer.
  2. Follow the installation instructions in the command prompt.
    • Use the default settings (standard installation) to add cargo, rustc, rustup to your PATH.
    • The Cargo home directory is, e.g., C:\Users\<User>\.cargo, which can be modified with the CARGO_HOME environment variable.
    • You may need to restart your command prompt or system.
    • Ensure that Cargo's bin directory is in your PATH.
  3. Additional Windows installation details are available in The rustup book.

Python Prerequisites

macOS

  1. Install Homebrew (if you don't have it already). Open the Terminal and run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install Python. After Homebrew is installed, run:
brew install python
  1. Verify Python and pip are installed:
python3 --version
pip3 --version

Linux

  1. Update Package List. Open a terminal and run:
sudo apt update
  1. Install Python and pip. For Ubuntu or Debian-based systems, run:
sudo apt install python3 python3-pip
  1. Verify Python and pip are installed:
python3 --version
pip3 --version

Windows

  1. Download Python. Go to the official Python website and download the latest version of Python for Windows.
  2. Run the Installer. During installation, make sure to check the box that says "Add Python to PATH."
  3. Verify Python and pip are installed:
python --version
pip --version

All Environments

On all environments, a virtual environment is recommended, but not required. Create a virtual environment:

python3 -m venv .venv  # venv, or
uv venv .venv          # using uv

uv is a fast Python package manager, written in Rust. It is an alternative to pip.

Activate the virtual environment:

source .venv/bin/activate       # for bash shell
source .venv/bin/activate.csh   # for c shell
source .venv/bin/activate.fish  # for fish shell
.\.venv\Scripts\activate        # for powershell

Step 2: Install automesh

Install the desired interface.

Command Line Interface

book crates

cargo install automesh

Rust Interface

crates docs

cargo add automesh

Python Interface

pypi docs

pip install automesh     # using pip, or
uv pip install automesh  # using uv

Step 3: Verify Installation

Rust Interfaces

Run the command line help:

automesh

which should display the following:


     @@@@@@@@@@@@@@@@
      @@@@  @@@@@@@@@@
     @@@@  @@@@@@@@@@@
    @@@@  @@@@@@@@@@@@    automesh: Automatic mesh generation
      @@    @@    @@      Chad B. Hovey <chovey@sandia.gov>
      @@    @@    @@      Michael R. Buche <mrbuche@sandia.gov>
    @@@@@@@@@@@@  @@@
    @@@@@@@@@@@  @@@@
    @@@@@@@@@@ @@@@@ @
     @@@@@@@@@@@@@@@@

Usage: automesh [COMMAND]

Commands:
  convert    Converts between mesh or segmentation file types
  defeature  Defeatures and creates a new segmentation
  diff       Show the difference between two segmentations
  extract    Extracts a specified range of voxels from a segmentation
  mesh       Creates a finite element mesh from a segmentation
  metrics    Quality metrics for an existing finite element mesh
  remesh     Applies isotropic remeshing to an existing mesh
  segment    Creates a segmentation or voxelized mesh from an existing mesh
  smooth     Applies smoothing to an existing mesh
  help       Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Python Interface

python

# In Python, import the module
>>> import automesh

# List all attributes and methods of the module
>>> dir(automesh)

# Get help on the module
>>> help(automesh)