Coder Social home page Coder Social logo

pyacvd's Introduction

PyVista

3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK)

pyvista

PyVista is:

  • Pythonic VTK: a high-level API to the Visualization Toolkit (VTK)
  • mesh data structures and filtering methods for spatial datasets
  • 3D plotting made simple and built for large/complex data geometries

PyVista is a helper module for the Visualization Toolkit (VTK) that wraps the VTK library through NumPy and direct array access through a variety of methods and classes. This package provides a Pythonic, well-documented interface exposing VTK's powerful visualization backend to facilitate rapid prototyping, analysis, and visual integration of spatially referenced datasets.

This module can be used for scientific plotting for presentations and research papers as well as a supporting module for other mesh 3D rendering dependent Python modules; see Connections for a list of projects that leverage PyVista.

Share this project on X: tweet

PyVista is a NumFOCUS affiliated project

NumFOCUS affiliated projects

Status badges

Deployment pypi conda
Build Status GH-CI python pre-commit.ci status
Metrics codacy codecov
Activity PyPIact condaact
Citation joss zenodo
License MIT
Community slack discuss
Formatter black isort prettier
Linter Ruff
Affiliated NumFOCUS Affiliated
Mentioned Awesome Scientific Computing

Highlights

Head over to the Quick Examples page in the docs to explore our gallery of examples showcasing what PyVista can do. Want to test-drive PyVista? All of the examples from the gallery are live on MyBinder for you to test drive without installing anything locally: Launch on Binder

Overview of Features

  • Extensive gallery of examples (see Quick Examples)
  • Interactive plotting in Jupyter Notebooks with server-side and client-side rendering with trame.
  • Filtering/plotting tools built for interactivity (see Widgets)
  • Direct access to mesh analysis and transformation routines (see Filters)
  • Intuitive plotting routines with matplotlib similar syntax (see Plotting)
  • Import meshes from many common formats (use pyvista.read()). Support for all formats handled by meshio is built-in.
  • Export meshes as VTK, STL, OBJ, or PLY (mesh.save()) file types or any formats supported by meshio (pyvista.save_meshio())

Documentation

Refer to the documentation for detailed installation and usage details.

For general questions about the project, its applications, or about software usage, please create a discussion in pyvista/discussions where the community can collectively address your questions. You are also welcome to join us on Slack.

Installation

PyVista can be installed from PyPI using pip on Python >= 3.8:

pip install pyvista

You can also visit PyPI, Anaconda, or GitHub to download the source.

See the Installation for more details regarding optional dependencies or if the installation through pip doesn't work out.

Connections

PyVista is a powerful tool that researchers can harness to create compelling, integrated visualizations of large datasets in an intuitive, Pythonic manner.

Learn more about how PyVista is used across science and engineering disciplines by a diverse community of users on our Connections page.

Authors

Please take a look at the contributors page and the active list of authors to learn more about the developers of PyVista.

contrib.rocks

Made with contrib rocks.

Contributing

Contributor Covenant Code Triage Open in GitHub Codespaces

We absolutely welcome contributions and we hope that our Contributing Guide will facilitate your ability to make PyVista better. PyVista is mostly maintained on a volunteer basis and thus we need to foster a community that can support user questions and develop new features to make this software a useful tool for all users while encouraging every member of the community to share their ideas. To learn more about contributing to PyVista, please see the Contributing Guide and our Code of Conduct.

Citing PyVista

There is a paper about PyVista.

If you are using PyVista in your scientific research, please help our scientific visibility by citing our work.

Sullivan and Kaszynski, (2019). PyVista: 3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK). Journal of Open Source Software, 4(37), 1450, https://doi.org/10.21105/joss.01450

BibTex:

@article{sullivan2019pyvista,
  doi = {10.21105/joss.01450},
  url = {https://doi.org/10.21105/joss.01450},
  year = {2019},
  month = {May},
  publisher = {The Open Journal},
  volume = {4},
  number = {37},
  pages = {1450},
  author = {Bane Sullivan and Alexander Kaszynski},
  title = {{PyVista}: {3D} plotting and mesh analysis through a streamlined interface for the {Visualization Toolkit} ({VTK})},
  journal = {Journal of Open Source Software}
}

Professional Support

While PyVista is an Open Source project with a big community, you might be looking for professional support. This section aims to list companies with VTK/PyVista expertise who can help you with your software project.

Company Name Kitware Inc.
Description Kitware is dedicated to build solutions for our customers based on our well-established open source platforms.
Expertise CMake, VTK, PyVista, ParaView, Trame
Contact https://www.kitware.com/contact/

pyacvd's People

Contributors

akaszynski avatar banesullivan avatar fedemiorelli avatar pre-commit-ci[bot] avatar ralic avatar sitic avatar truenicoco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pyacvd's Issues

Cannot install PyACVD for python3

Here is what I tried:
pip3 install PyACVD

Here is what I get:

Collecting PyACVD
  Using cached PyACVD-0.1.1.tar.gz
Building wheels for collected packages: PyACVD
  Running setup.py bdist_wheel for PyACVD ... error
  Complete output from command /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/private/var/folders/v8/vmb7nyj95slb3f__hc5r9x5h0000gn/T/pip-build-3a3roe5x/PyACVD/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/v8/vmb7nyj95slb3f__hc5r9x5h0000gn/T/tmplbwuglhfpip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.6-intel-3.5
  creating build/lib.macosx-10.6-intel-3.5/PyACVD
  copying PyACVD/__init__.py -> build/lib.macosx-10.6-intel-3.5/PyACVD
  copying PyACVD/Clustering.py -> build/lib.macosx-10.6-intel-3.5/PyACVD
  copying PyACVD/VTK_Plotting.py -> build/lib.macosx-10.6-intel-3.5/PyACVD
  creating build/lib.macosx-10.6-intel-3.5/PyACVD/Tests
  copying PyACVD/Tests/__init__.py -> build/lib.macosx-10.6-intel-3.5/PyACVD/Tests
  copying PyACVD/Tests/Remesh.py -> build/lib.macosx-10.6-intel-3.5/PyACVD/Tests
  copying PyACVD/Tests/StanfordBunny.ply -> build/lib.macosx-10.6-intel-3.5/PyACVD/Tests
  running build_ext
  building 'PyACVD.Clustering_Cython' extension
  creating build/temp.macosx-10.6-intel-3.5
  creating build/temp.macosx-10.6-intel-3.5/PyACVD
  creating build/temp.macosx-10.6-intel-3.5/PyACVD/cython
  ccache clang -Qunused-arguments -fcolor-diagnostics -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/core/include -c PyACVD/cython/Clustering_Cython.cpp -o build/temp.macosx-10.6-intel-3.5/PyACVD/cython/Clustering_Cython.o
  clang: error: no such file or directory: 'PyACVD/cython/Clustering_Cython.cpp'
  clang: error: no input files
  error: command 'ccache' failed with exit status 1

  ----------------------------------------
  Failed building wheel for PyACVD
  Running setup.py clean for PyACVD
Failed to build PyACVD
Installing collected packages: PyACVD
  Running setup.py install for PyACVD ... error
    Complete output from command /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/private/var/folders/v8/vmb7nyj95slb3f__hc5r9x5h0000gn/T/pip-build-3a3roe5x/PyACVD/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/v8/vmb7nyj95slb3f__hc5r9x5h0000gn/T/pip-7jmf0xkh-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.6-intel-3.5
    creating build/lib.macosx-10.6-intel-3.5/PyACVD
    copying PyACVD/__init__.py -> build/lib.macosx-10.6-intel-3.5/PyACVD
    copying PyACVD/Clustering.py -> build/lib.macosx-10.6-intel-3.5/PyACVD
    copying PyACVD/VTK_Plotting.py -> build/lib.macosx-10.6-intel-3.5/PyACVD
    creating build/lib.macosx-10.6-intel-3.5/PyACVD/Tests
    copying PyACVD/Tests/__init__.py -> build/lib.macosx-10.6-intel-3.5/PyACVD/Tests
    copying PyACVD/Tests/Remesh.py -> build/lib.macosx-10.6-intel-3.5/PyACVD/Tests
    copying PyACVD/Tests/StanfordBunny.ply -> build/lib.macosx-10.6-intel-3.5/PyACVD/Tests
    running build_ext
    building 'PyACVD.Clustering_Cython' extension
    creating build/temp.macosx-10.6-intel-3.5
    creating build/temp.macosx-10.6-intel-3.5/PyACVD
    creating build/temp.macosx-10.6-intel-3.5/PyACVD/cython
    ccache clang -Qunused-arguments -fcolor-diagnostics -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/core/include -c PyACVD/cython/Clustering_Cython.cpp -o build/temp.macosx-10.6-intel-3.5/PyACVD/cython/Clustering_Cython.o
    clang: error: no such file or directory: 'PyACVD/cython/Clustering_Cython.cpp'
    clang: error: no input files
    error: command 'ccache' failed with exit status 1

    ----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/private/var/folders/v8/vmb7nyj95slb3f__hc5r9x5h0000gn/T/pip-build-3a3roe5x/PyACVD/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/v8/vmb7nyj95slb3f__hc5r9x5h0000gn/T/pip-7jmf0xkh-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/v8/vmb7nyj95slb3f__hc5r9x5h0000gn/T/pip-build-3a3roe5x/PyACVD/

I am running python 3.5.2, and pip 8.1.2, on MacOS 10.11.6

Erroneous sub-triangle

Under some conditions, pyacvd produces incorrect triangles, as seen in the image below:
triangles

The small triangle is indeed inside the large one, resulting in incorrect half-edge structure. Changing the number of subdivsions or the cluster parameter solves this. However, it is inconvenient to rerun the whole application once this pops up.

Could you help me with this? I can provide input files to reproduce the issue.

ImportError: cannot import name '_clustering' from 'pyacvd'

Hi, there are some problem when I run this code.

Traceback (most recent call last):
File "/home/cyj/project/others/pyacvd/example.py", line 2, in
import pyacvd
File "/home/cyj/project/others/pyacvd/pyacvd/init.py", line 1, in
from pyacvd.clustering import Clustering
File "/home/cyj/project/others/pyacvd/pyacvd/clustering.py", line 6, in
from pyacvd import _clustering
ImportError: cannot import name '_clustering' from 'pyacvd' (/home/cyj/project/others/pyacvd/pyacvd/init.py)

Randomly inside-outsided mesh generated by create_mesh()

Hi

Following the README, I created and saved new mesh file by remesh.save("test.ply").
Although it looks fine in built-in viewer remesh.plot(color='w', show_edges=True), I found that the output includes randomly inside-outside reversed faces.

For example, when visualized by meshlab, the mesh looks like

snapshot01

[Feature Request] Anaconda package

When time permits, ...so, never it'd be great to publish a conda package for PyACVD. Assuming conda-forge, hot behind-the-scenes automation will automatically bump the conda package for you on each PyPI bump โ€“ saving precious dev time for fun things like full-blown ACVD bindings. ๐Ÿ˜‰

Thanks for all the Pythonic volunteerism, Alex. PyACVD is jaw-droppingly awesome! The resulting meshes are a big improvement over standard implicit modelling techniques available in VTK and PyVista like marching cubes and flying edges.

How to use this with vtkPolyData?

Thank you for providing this package! How can I use this package if I have the input as vtkPolyData and would need the processed mesh as vtkPolyData? All the examples use some pyvista mesh objects and I don't know how to convert those to/from vtkPolyData.

Clustering fails due to vtkSubdivisionFilter

I have a mesh, that I'm trying to resample with the ACVD algorithm. While the mesh is manifold, the subdivision filter employed by the ACVD algorithm appears to return a non-manifold mesh, that makes the algorithm crash mid-way.

In particular:

import pyvista as pv
from PyACVD import Clustering

mesh = pv.PolyData('shoot_manifold_acvd_crash.ply')
non_manifold_edges = mesh.extract_edges(feature_edges=False, boundary_edges=False, 
                                        manifold_edges=False, non_manifold_edges=True)
print(non_manifold_edges.n_cells, non_manifold_edges.n_points)
0 0

The step that fails is the generation of the clusters:

cobj = Clustering.Cluster(mesh)
cobj.GenClusters(mesh.n_points)
Subdividing mesh with 3 subdivision(s)
ERROR:root:Dataset is non-manifold and cannot be subdivided. Edge shared by 4 cells
ERROR:root:Subdivision failed.
ERROR:root:vtkInformation (0x55df794fb890)
Traceback (most recent call last):

  File "<ipython-input-2-be1bf5dcec33>", line 2, in <module>
    cobj.GenClusters(mesh.n_points)

  File "/home/henrik/.local/anaconda2/envs/surface/lib/python3.7/site-packages/PyACVD/Clustering.py", line 184, in GenClusters
    self.PrepareMesh(nclus, subratio, verbose)

  File "/home/henrik/.local/anaconda2/envs/surface/lib/python3.7/site-packages/PyACVD/Clustering.py", line 139, in PrepareMesh
    v = VN.vtk_to_numpy(self.mesh.GetPoints().GetData()).astype(np.float)

AttributeError: 'NoneType' object has no attribute 'GetData'

Digging deeper shows that this is due to the subdivision that is happening inside the mesh preparation step:

mesh.subdivide(3, 'loop')
ERROR:root:Dataset is non-manifold and cannot be subdivided. Edge shared by 4 cells
ERROR:root:Subdivision failed.
ERROR:root:vtkInformation (0x55df796458b0)
PolyData (0x7ff0b08cab28)
  N Cells:	0
  N Points:	0
  X Bounds:	1.000e+00, -1.000e+00
  Y Bounds:	1.000e+00, -1.000e+00
  Z Bounds:	1.000e+00, -1.000e+00
  N Scalars:	0
mesh.subdivide(2, 'loop')
mesh.subdivide(2, 'loop')
ERROR:root:Dataset is non-manifold and cannot be subdivided. Edge shared by 4 cells
ERROR:root:Subdivision failed.
ERROR:root:vtkInformation (0x55df79436670)
PolyData (0x7ff0b08caa68)
  N Cells:	0
  N Points:	0
  X Bounds:	1.000e+00, -1.000e+00
  Y Bounds:	1.000e+00, -1.000e+00
  Z Bounds:	1.000e+00, -1.000e+00
  N Scalars:	0

Notably, the issue doesn't arise for when only a single subdivision is needed, but the output of that is non-manifold.

mesh = mesh.subdivide(1, 'loop')
non_manifold_edges = mesh.extract_edges(feature_edges=False, boundary_edges=False, 
                                        manifold_edges=False, non_manifold_edges=True)
print(non_manifold_edges.n_cells, non_manifold_edges.n_points)
18 18

Import error when installing module via pip

Hi

Just tried to run your module, but I was not able to load it.

Here is what I tried:

  • pip install PyACVD => installed successfully
  • python -c "import PyACVD"

Here is what I get:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyACVD/__init__.py", line 1, in <module>
    from PyACVD import Clustering_Cython
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyACVD/Clustering_Cython.so, 2): Symbol not found: __ZTINSt8ios_base7failureE
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyACVD/Clustering_Cython.so
  Expected in: flat namespace
 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyACVD/Clustering_Cython.so

I am running python 2.7.12 on MacOS 10.11.6.

pyvista 0.2.6 does not work with numpy 1.18.5

I'm trying to use pyvista in broader context (with tensorflow 2.3, which needs numpy 1.18.5). While I am aware 'its not your problem what is my current package setup'. I just want to know if you plan to support older versions of numpy?

For pyacvd 0.2.6:
creating fresh python 3.7 environment, and installing from pip: pyacvd==0.2.6 and then numpy 1.18.5: results in exception during import of pyacvd in python terminal/script:

import pyacvd
Traceback (most recent call last):
File "", line 1, in
File "/home/user123/progs/anaconda3/envs/envone37pv1/lib/python3.7/site-packages/pyacvd/init.py", line 1, in
from pyacvd.clustering import Clustering
File "/home/user123/progs/anaconda3/envs/envone37pv1/lib/python3.7/site-packages/pyacvd/clustering.py", line 7, in
from pyacvd import _clustering
File "pyacvd/cython/_clustering.pyx", line 1, in init pyacvd._clustering
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

For pyacvd 0.2.5:
creating fresh python 3.7 environment, and installing from pip: pyacvd==0.2.5 and then numpy 1.18.5: results in proper import of pyacvd in python terminal/script (all works ok)

Latest pyacvd 0.2.9 compilation from source fails when code is taken from PyPI

Latest pyacvd 0.2.9 compilation from source fails when code is taken from PyPI, https://files.pythonhosted.org/packages/d7/9d/1d10109cbd9409e0885d5a824ff2610d3adf2a2066a90abb66490ae9706a/pyacvd-0.2.9.tar.gz

Looks like this is fixed in main branch long time ago but PyPI source needs update.

D:\build_pyacvd\pyacvd-0.2.9>python -m pip install .
Processing d:\build_pyacvd\pyacvd-0.2.9
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  ร— Getting requirements to build wheel did not run successfully.
  โ”‚ exit code: 1
  โ•ฐโ”€> [21 lines of output]
      Traceback (most recent call last):
        File "C:\DE-Python\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
          main()
        File "C:\DE-Python\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\DE-Python\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\ashish.shirodkar\AppData\Local\Temp\pip-build-env-ae4d0jag\overlay\Lib\site-packages\setuptools\build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\ashish.shirodkar\AppData\Local\Temp\pip-build-env-ae4d0jag\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "C:\Users\ashish.shirodkar\AppData\Local\Temp\pip-build-env-ae4d0jag\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 28, in <module>
        File "C:\Users\ashish.shirodkar\AppData\Local\Temp\pip-build-env-ae4d0jag\overlay\Lib\site-packages\Cython\Build\Dependencies.py", line 1010, in cythonize
          module_list, module_metadata = create_extension_list(
        File "C:\Users\ashish.shirodkar\AppData\Local\Temp\pip-build-env-ae4d0jag\overlay\Lib\site-packages\Cython\Build\Dependencies.py", line 845, in create_extension_list
          for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
        File "C:\Users\ashish.shirodkar\AppData\Local\Temp\pip-build-env-ae4d0jag\overlay\Lib\site-packages\Cython\Build\Dependencies.py", line 117, in nonempty
          raise ValueError(error_msg)
      ValueError: 'pyacvd/cython/_clustering.pyx' doesn't match any files
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

ร— Getting requirements to build wheel did not run successfully.
โ”‚ exit code: 1
โ•ฐโ”€> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

How to load and export mesh

Hi,

I would like to know how to use this library for loading an input mesh from my hard disk and then exporting the remeshed output, for example in OBJ format.

Thank you in advance!

Best,
HollowHeartNet

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.