Skip to main content

Add a short description here!

Project description

PyPI version Build Status

volume2mesh

Voxelize meshes to volumes. Save meshes from volumes.

This package provides to functions volume2mesh and mesh2volume to convert between NumPy volume arrays and meshes:

file = '/tmp/my_mesh_file.obj'
volume = np.zeros((100, 120, 131), np.float32)
volume[20:40, 30:40, 40:50] = 1

volume2mesh(file,
           volume,
           threshold=0.5,
           adaptivity=0.,
           spacing=[1., 1., 1.],
           origin=[0., 0., 0.],
           binary_file=True,
           only_write_biggest_components=False,
           max_component_count=1)

And to voxelize meshes:

bunny_file = join('~/my_bunnyfile.stl')
volume = volume2mesh.mesh2volume(bunny_file, scaling=1.)

Installation

You need to have OpenMesh linkable via -lOpenMeshCore and OpenVDB installed.

On on Ubuntu, you can do this these commands (see our Travis Script):

# Install OpenVDB
sudo apt-get install -y libopenvdb-dev build-essential libboost-all-dev libtbb-dev

# Install OpenMesh
git clone https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh.git || echo "hi"
cd OpenMesh
git pull
mkdir -p release
cd release && cmake -DCMAKE_BUILD_TYPE=Release .. && cmake --build . -- -j4
sudo make install

# Install this package
pip3 install volume2mesh --user
# Or if you cloned this repo
pip3 install -e . --user

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for volume2mesh, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size volume2mesh-0.2.2.tar.gz (821.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page