zmesh 1.8.0
pip install zmesh
Released:
Multilabel marching cubes and simplification of volumetric data.
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: GNU General Public License v3 or later (GPLv3+) (GPLv3+)
- Author: William Silversmith (maintainer), Aleks Zlateski (original author)
- Requires: Python >=3.8
Classifiers
- Development Status
- Intended Audience
- License
- Programming Language
- Topic
Project description
zmesh: Multi-Label Marching Cubes & Mesh Simplification
from zmesh import Mesher
labels = ... # some dense volumetric labeled image
mesher = Mesher( (4,4,40) ) # anisotropy of image
# initial marching cubes pass
# close controls whether meshes touching
# the image boundary are left open or closed
mesher.mesh(labels, close=False)
meshes = []
for obj_id in mesher.ids():
meshes.append(
mesher.get(
obj_id,
normals=False, # whether to calculate normals or not
# tries to reduce triangles by this factor
# 0 disables simplification
reduction_factor=100,
# Max tolerable error in physical distance
# note: if max_error is not set, the max error
# will be set equivalent to one voxel along the
# smallest dimension.
max_error=8,
# whether meshes should be centered in the voxel
# on (0,0,0) [False] or (0.5,0.5,0.5) [True]
voxel_centered=False,
)
)
mesher.erase(obj_id) # delete high res mesh
mesher.clear() # clear memory retained by mesher
mesh = meshes[0]
mesh = mesher.simplify(
mesh,
# same as reduction_factor in get
reduction_factor=100,
# same as max_error in get
max_error=40,
compute_normals=False, # whether to also compute face normals
) # apply simplifier to a pre-existing mesh
# compute normals without simplifying
mesh = mesher.compute_normals(mesh)
mesh.vertices
mesh.faces
mesh.normals
mesh.triangles() # compute triangles from vertices and faces
# Extremely common obj format
with open('iconic_doge.obj', 'wb') as f:
f.write(mesh.to_obj())
# Common binary format
with open('iconic_doge.ply', 'wb') as f:
f.write(mesh.to_ply())
# Neuroglancer Precomputed format
with open('10001001:0', 'wb') as f:
f.write(mesh.to_precomputed())
Note: As of the latest version, mesher.get_mesh
has been deprecated in favor of mesher.get
which fixes a long standing bug where you needed to transpose your data in order to get a mesh in the correct orientation.
Installation
If binaries are not available for your system, ensure you have a C++ compiler installed.
pip install zmesh
Performance Tuning & Notes
- The mesher will consume about double memory in 64 bit mode if the size of the object exceeds <1023, 1023, 511> on the x, y, or z axes. This is due to a limitation of the 32-bit format.
- The mesher is ambidextrous, it can handle C or Fortran order arrays.
- The maximum vertex range supported
.simplify
after converting to voxel space is 220 (appx. 1M) due to the packed 64-bit vertex format.
Related Projects
- zi_lib - zmesh makes heavy use of Aleks' C++ library.
- Igneous - Visualization of connectomics data using cloud computing.
Credits
Thanks to Aleks Zlateski for creating and sharing this beautiful mesher.
Later changes by Will Silversmith, Nico Kemnitz, and Jingpeng Wu.
References
- W. Lorensen and H. Cline. "Marching Cubes: A High Resolution 3D Surface Construction Algorithm". pp 163-169. Computer Graphics, Volume 21, Number 4, July 1987. (link)
- M. Garland and P. Heckbert. "Surface simplification using quadric error metrics". SIGGRAPH '97: Proceedings of the 24th annual conference on Computer graphics and interactive techniques. Pages 209–216. August 1997. doi: 10.1145/258734.258849 (link)
- H. Hoppe. "New Quadric Metric for Simplifying Meshes with Appearance Attributes". IEEE Visualization 1999 Conference. pp. 59-66. doi: 10.1109/VISUAL.1999.809869 (link)
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: GNU General Public License v3 or later (GPLv3+) (GPLv3+)
- Author: William Silversmith (maintainer), Aleks Zlateski (original author)
- Requires: Python >=3.8
Classifiers
- Development Status
- Intended Audience
- License
- Programming Language
- Topic
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Uploaded
CPython 3.12
manylinux: glibc 2.17+ x86-64
Uploaded
CPython 3.12
macOS 10.9+ universal2 (ARM64, x86-64)
Uploaded
CPython 3.11
manylinux: glibc 2.17+ x86-64
Uploaded
CPython 3.11
macOS 10.9+ universal2 (ARM64, x86-64)
Uploaded
CPython 3.10
manylinux: glibc 2.17+ x86-64
Uploaded
CPython 3.10
macOS 10.9+ universal2 (ARM64, x86-64)
Uploaded
CPython 3.9
manylinux: glibc 2.17+ x86-64
Uploaded
CPython 3.9
macOS 10.9+ universal2 (ARM64, x86-64)
Uploaded
CPython 3.8
manylinux: glibc 2.17+ x86-64
Uploaded
CPython 3.8
macOS 11.0+ universal2 (ARM64, x86-64)
File details
Details for the file zmesh-1.8.0.tar.gz
.
File metadata
- Download URL: zmesh-1.8.0.tar.gz
- Upload date:
- Size: 263.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5811f8794a14ce1d8796758408a64ad2c2c752bace0574d0195f4f43e741ba38 |
|
MD5 | 04ee88a17481d10d90e09993d6a0643d |
|
BLAKE2b-256 | 63da87d51faee9b9e3298cf78df843eee5fa8fb155c3e09edfaa167b439ec916 |
File details
Details for the file zmesh-1.8.0-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 157.3 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0bee3c29718a8e4d1a6cfba9cfc37913349946ce12ea456b78e34013782501c |
|
MD5 | 93d809f261d74dda8862cd388364f932 |
|
BLAKE2b-256 | 42a22f4628621060cbc79a14b5ea987e0e91a8a1a54d0ab587330029f5561932 |
File details
Details for the file zmesh-1.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a8b69f854f083b235508e989476bb42e1cc5f37515f748cc8a9afd2991e0368 |
|
MD5 | db2ff39735557570a2ebe2613a8e7298 |
|
BLAKE2b-256 | 0c4786755361ba0c7b83aed2cdbe6e2d221479da2c6c4fcf61da036633da04ce |
File details
Details for the file zmesh-1.8.0-cp312-cp312-macosx_10_9_universal2.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp312-cp312-macosx_10_9_universal2.whl
- Upload date:
- Size: 372.0 kB
- Tags: CPython 3.12, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d55196ce8a3b52071222701236e2f4ba483262876c94df1c9e5cae123264c4f9 |
|
MD5 | 743cd9d75baa04ef4c7bd462ef6ea3c2 |
|
BLAKE2b-256 | fd46549083ef39f15ad4dd9fc7e01f298b37b9113504b2adefbbf3f0466c5c76 |
File details
Details for the file zmesh-1.8.0-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 159.6 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2abe1bf663ce8d0fcbd45e3f5085be2585cee20932469037e7dcc16e878ccf58 |
|
MD5 | 499ff313a569931eb0109dd969d07d31 |
|
BLAKE2b-256 | 47e48370628019c94a38f20cdb812fca52dabaccb0c434e2be939624c58feb75 |
File details
Details for the file zmesh-1.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f563a3a215a3d71912c7a00abc376b3606240c8b23411301db0a123b1acf6ef |
|
MD5 | 778236f1918cdc12dafbb2ae651798c1 |
|
BLAKE2b-256 | 79378316f20907ebd930ac126db1f46f3ad979c709ca16258ac0966b595a820e |
File details
Details for the file zmesh-1.8.0-cp311-cp311-macosx_10_9_universal2.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp311-cp311-macosx_10_9_universal2.whl
- Upload date:
- Size: 378.0 kB
- Tags: CPython 3.11, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3cf177bf21b5f328b8388907cf082d30bb338e74cdf9310ef2e8f0358fb1faf |
|
MD5 | e83c416c76d45e52f461e85794a0c8c7 |
|
BLAKE2b-256 | 328be89afd49db02df0c3915f6608e1fd192c3d5941ad830c039ddc0b38cf9ac |
File details
Details for the file zmesh-1.8.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 159.5 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf841f2979e7384db2545d9c253a6976163d56813dbd15a7708cbb9dcc4eaf10 |
|
MD5 | c2f5debb127705054978a9d83b007af7 |
|
BLAKE2b-256 | b07ff034d91b55d8ef8a5a7e5f232a6a52fb2754a4189692bc641b86abe68f3f |
File details
Details for the file zmesh-1.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e455aa2f5862957dd059fdf1ef0184ea65f93283a1b5750463c812ee5d02e78 |
|
MD5 | 4828230f047bdd2134aad06d870f0dce |
|
BLAKE2b-256 | be45bbd9a5770731f8644bdccd8c822b74ab1dc3c21cbe35d0e6ee24091b0605 |
File details
Details for the file zmesh-1.8.0-cp310-cp310-macosx_10_9_universal2.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp310-cp310-macosx_10_9_universal2.whl
- Upload date:
- Size: 375.0 kB
- Tags: CPython 3.10, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47021fb62281c0fa0eab1eebb48c3f4d940cb8fe6e6e38ef362e50acd51a4ceb |
|
MD5 | c7c087d3146da36a1fb0e7fa3b1fbf2f |
|
BLAKE2b-256 | e90c507f91332d3d82cd4e10cc43b49d532f6d7a1cb0ec04f5837cd946423510 |
File details
Details for the file zmesh-1.8.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 160.0 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ed992a733e298c3421b72bfde1fcc9fb77be2d76865401aac3d82a66bad525a |
|
MD5 | 37a4ae0146c96d7b87b37299378d9bfc |
|
BLAKE2b-256 | e80de9af5a02944c1d8bdc8e5efb0ae08abb69ed015ca667f0914f03a2229829 |
File details
Details for the file zmesh-1.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ea5e63cffb348649cc342574dc3b65dd19378b807ed0562bfa8ed4ea29a9553 |
|
MD5 | 24fab3eef193a23e3c65105b4b25db66 |
|
BLAKE2b-256 | 7049f3e914b9c4fcd6d16711a1df7804905d79a5160dd5452bdbfa8844fd3b42 |
File details
Details for the file zmesh-1.8.0-cp39-cp39-macosx_10_9_universal2.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp39-cp39-macosx_10_9_universal2.whl
- Upload date:
- Size: 376.2 kB
- Tags: CPython 3.9, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 038b5f5b0ccdf73a56f40878047e4e6fbde7a817e5b446d3896bb6c9ffb81df8 |
|
MD5 | ee2f10c53df3f70bcd644f5d5f5c07e2 |
|
BLAKE2b-256 | a8cad57f037132e8a0f6d64dc05f8455bb7fd50460e27c765eb208267f251f85 |
File details
Details for the file zmesh-1.8.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 160.9 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42c64b40240324b6de5ac34d8d65a206df1751592935973b71b901c677d2d3d6 |
|
MD5 | 970c8f08c672d61152a9e1655a7858a8 |
|
BLAKE2b-256 | 4f3f8c13bd268a8a4035cf6431ef74c603340143b4fa8079ef5d6e4a8a07304b |
File details
Details for the file zmesh-1.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c960fbda9ff9f5e0ac54a3c83ea5981eb530060535bc45380a20de3a45199ea8 |
|
MD5 | 5f02fce5cd658a4907b138afee1fdecf |
|
BLAKE2b-256 | 35b64da47f8238499efedfd6ce465792fe2354aa9b21a8ad8b180c668f66055c |
File details
Details for the file zmesh-1.8.0-cp38-cp38-macosx_11_0_universal2.whl
.
File metadata
- Download URL: zmesh-1.8.0-cp38-cp38-macosx_11_0_universal2.whl
- Upload date:
- Size: 331.3 kB
- Tags: CPython 3.8, macOS 11.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c948938fa47ed1e0a807120b9ca63ce17fd1404a85c445d293ea1fd61124bb16 |
|
MD5 | e26396dc127c51f6a7643de4c2700d77 |
|
BLAKE2b-256 | 4eab47cb9817c040b0089ed2cb75ae66588d645b35ae2d5685add44397788d91 |