GithubHelp home page GithubHelp logo

pyvista / pyvista Goto Github PK

View Code? Open in Web Editor NEW
2.4K 36.0 429.0 255.52 MB

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

Home Page: https://docs.pyvista.org

License: MIT License

Python 99.80% TeX 0.12% Makefile 0.03% Dockerfile 0.04% Shell 0.01%
vtk open-science python visualization 3d meshviewer scientific-visualization scientific-research plotting mesh

pyvista'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/

pyvista's People

Contributors

adeak avatar akaszynski avatar alejandrofernandezluces avatar annehaley avatar banesullivan avatar beroda avatar darikg avatar dcbr avatar dependabot[bot] avatar germa89 avatar github-actions[bot] avatar guillaumefavelier avatar imsodin avatar jevinj avatar jmargeta avatar keou0007 avatar keurfonluu avatar kmarchais avatar larsoner avatar math-artist avatar matthewflamm avatar mwtoews avatar pre-commit-ci[bot] avatar puripant avatar richardscottoz avatar rodrigomologni avatar supersubscript avatar tkoyama010 avatar user27182 avatar whophil 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  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

pyvista's Issues

change color of axes widget labels

I cannot figure out how to change the color of the labels on the axes widget. Any ideas?

I ask because white text on the document plotting theme with a white background does not look good (see below). I'd like to be able to change it to black.

screen shot 2019-02-11 at 2 27 22 pm 1

enable math-tex for labels

I know it is somehow possible to use math-tex / LaTeX math formatting for labels in VTK, but how can we enable it in vtki? For example:

plotter.add_bounds_axes(xlabel='$F^2$')

plotter.add_mesh(data, stitle='$stuff^2$')

ValueError: multiple inheritance is not allowed with VTK classes

I am using conda 4.3.25 on Windows, and I have created an environment for python 2.7 in order to be able to install vtk.
Then I have installed pyansys and vtkInterface using pip.
When trying to import pyansys i get

Python 2.7.13 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:17:26) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import pyansys
C:\Users\myusername\AppData\Local\Continuum\Anaconda3\envs\py27\lib\site-packages\pyansys\archive_reader.py:32: UserWarning: Unable to load vtk dependent modules
  warnings.warn('Unable to load vtk dependent modules')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\myusername\AppData\Local\Continuum\Anaconda3\envs\py27\lib\site-packages\pyansys\__init__.py", line 4, in <module>
    from pyansys.binary_reader import *
  File "C:\Users\myusername\AppData\Local\Continuum\Anaconda3\envs\py27\lib\site-packages\pyansys\binary_reader.py", line 7, in <module>
    import vtkInterface
  File "C:\Users\myusername\AppData\Local\Continuum\Anaconda3\envs\py27\lib\site-packages\vtkInterface\__init__.py", line 7, in <module>
    from vtkInterface.polydata import PolyData
  File "C:\Users\myusername\AppData\Local\Continuum\Anaconda3\envs\py27\lib\site-packages\vtkInterface\polydata.py", line 22, in <module>
    class PolyData(vtkPolyData, vtkInterface.Common):
ValueError: multiple inheritance is not allowed with VTK classes

Any clue on how to solve this ?

Qt Interactive Renderer Mouse Location Bug

Something isn't right with the Qt renderer mouse locations. When interacting with the axes widget, it detects that the user is hovering over it at the wrong locations... see video below.

Perhaps this is why we can't move the interactive scalar bar widget in #79

ezgif com-video-to-gif

CI Testing and Code Coverage

I see the Travis script uses pytest-cov, does this test runner report code coverage?

Do you, @akaszynski, by chance have the coverage reported to a service like codecov?

This would be a major help for me to figure out what still needs testing as I've added quite a bit of untested code in the last 24 hours

Eye Dome Lighting (EDL)

Can we implement the vtk.vtkEDLShading class to get eye dome lighting? Check out this blog post on how ParaView implements it.

I've been working with a lot of point clouds lately and ParaView's EDL view makes seeing the clouds so much easier. Note the comparison below. It would be really nice to have the option to apply this shader to only specific datasets in a scene but that might not be possible.

Screen Shot 2019-03-13 at 11 26 49 PM

Note: https://discourse.vtk.org/t/eye-dome-lighting-vtkedlshading-example-request/508

vtkTable wrapper

I'm mulling over whether or not to implement a vtkTable wrapper in vtki and I'm curious about other's thoughts.

The vtkTable is a very common dataset I use and I have some functions in PVGeo that will convert them back and forth to Pandas DataFrame objects (basically just tables with an awesome interface).

My hesitations are:

  1. vtkTables are subclasses of vtkDataObjects not vtkDataSets unlike everything else in vtki. This means we'd have to set up a new/separate module for DataObject wrappers.
  2. We'd have to add Pandas as a dependency to the project (or maybe just an extra)
  3. What would the interface look like? Would we build out a Pandas DataFrame with callbacks to the VTK data object?
  4. Is this even worth doing considering it will be entirely different than everything else in vtki (as in it will be quite time consuming to get right)

Option to edit PolyData in-place for core processing functions

Proposed solution

There are some PolyData functions that I think would benefit from having an option to edit the input object in place. I would suggest adding this functionality as a function argument in the style of e.g.

    def Decimate(self, target_reduction, ..., inplace=False):

        <...>

        if inplace:
            self.Overwrite(decimate.GetOutput())
        else:
            return PolyData(decimate.GetOutput())

Candidate functions for this feature include (but aren't limited to)

  • PolyData.Decimate
  • PolyData.Boolean[Cut,Add,Union]
  • PolyData.Normals (see PR)
  • PolyData.RemovePoints
  • PolyData.TriFilter
  • PolyData.Subdivide (already has it!)

Similarly, for the functions that exclusively do in-place operations, it might be good to add the flexibility to be able to return the object (such as for PolyData.Clean etc.).

Motivation

Not having inplace arguments breaks code style consistency. Example:

mesh.ClipPlane([0, 0, 0], [0,0,1])
mesh.ExtractLargest()
mesh.FillHoles(100.0)
mesh.FlipNormals()
normals = mesh.Normals()
mesh.SetNormals(*normals)
mesh.Clean()
mesh = mesh.Decimate(0.9)

Plotting in background is broken

Something happened between v0.13.1 and v0.14.0 that broke the in_background plotting:

Here is a simple example with an input prompt to not exit the task:

import vtki
from vtki import examples

dataset = examples.load_uniform()

p = vtki.Plotter(notebook=False)
p.add_mesh(dataset)
p.plot(in_background=True)

input('Let me know when you're done:')

Works as expected on v0.13.1 but is broken on v0.14.0 with the following output to the console:

The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
2019-01-08 18:12:24.332 python[2136:35526] Warning: CGSSetSurfaceProperty had error 268435459 during sync of extended DR for {NSSurface 0x7fd76a1075d0: _view=0x7fd764ecf210, _window=0x7fd767ca1f00, _frame={{0, 0}, {150, 150}}, res=2.0, _surfaceID=4137, _backingStore=0, _graphicsContext=0x0, _focused=0}
2019-01-08 18:12:24.333 python[2136:35526] CGSGetSurfaceBounds failed - error 268435459 (window:1028, surface:4137
2019-01-08 18:12:24.333 python[2136:35526] CGSSetSurfaceShape failed - error 268435459 (window:1028, surface:4137, bounds:{{0, 0}, {150, 150}}
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
2019-01-08 18:12:24.335 python[2136:35526] Warning: CGSSetSurfaceProperty had error 268435459 during sync of extended DR for {NSSurface 0x7fd76a1075d0: _view=0x7fd764ecf210, _window=0x7fd767ca1f00, _frame={{0, 0}, {150, 150}}, res=2.0, _surfaceID=4137, _backingStore=0, _graphicsContext=0x0, _focused=0}
2019-01-08 18:12:24.335 python[2136:35526] CGSGetSurfaceBounds failed - error 268435459 (window:1028, surface:4137
2019-01-08 18:12:24.336 python[2136:35526] CGSSetSurfaceShape failed - error 268435459 (window:1028, surface:4137, bounds:{{0, 0}, {512, 384}}
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
python(2136,0x10c1595c0) malloc: *** can't vm_purgable_control(..., VM_PURGABLE_SET_STATE) for large freed block at 0x11667a000
python(2136,0x10c1595c0) malloc: can't allocate region
*** mach_vm_map(size=18446576513437405184) failed (error code=4)
python(2136,0x10c1595c0) malloc: *** set a breakpoint in malloc_error_break to debug
python(2136,0x10c1595c0) malloc: can't allocate region
*** mach_vm_map(size=18446576513437405184) failed (error code=4)
python(2136,0x10c1595c0) malloc: *** set a breakpoint in malloc_error_break to debug
python(2136,0x10c1595c0) malloc: can't allocate region
*** mach_vm_map(size=18446576513437405184) failed (error code=4)
python(2136,0x10c1595c0) malloc: *** set a breakpoint in malloc_error_break to debug
python(2136,0x10c1595c0) malloc: can't allocate region
*** mach_vm_map(size=18446576513437405184) failed (error code=4)
python(2136,0x10c1595c0) malloc: *** set a breakpoint in malloc_error_break to debug
python(2136,0x10c1595c0) malloc: can't allocate region
*** mach_vm_map(size=18446576513437405184) failed (error code=4)
python(2136,0x10c1595c0) malloc: *** set a breakpoint in malloc_error_break to debug
python(2136,0x10c1595c0) malloc: can't allocate region
*** mach_vm_map(size=18446576513437405184) failed (error code=4)
python(2136,0x10c1595c0) malloc: *** set a breakpoint in malloc_error_break to debug

This is necessary for #33

Probably bug in UpdateCoordinates (plottingg.py)

def UpdateCoordinates(self, points, mesh=None, render=True):
""" updates points of object (point only for now)
assumes last inputted mesh if mesh left empty
"""'
if mesh is None:
mesh = self.mesh
self.mesh.SetNumpyPoints(points)
if render:
self.Render()

self.mesh.SetNumpyPoints(points) probable should be mesh.SetNumpyPoints(points)

jupyter notebook with vtki

hi all:
This project is very interesting for visualization based on VTK.
I want to use vtkInterface with jupyter notebook then i can view the result in notebook.
Maybe, it can integrate with pythreejs.
Current, the result show in another window as following:

screen shot 2018-08-15 at 15 25 14

@akaszynski do you have a plan for rendering on jupyter ?

Close button on plotter window is broken

When closing a plotter, you currently must press the q button. If you press the exit button in the window, the plotter does not properly closed. For example:

import vtki
from vtki import examples

data = examples.load_uniform()

p = vtki.Plotter(notebook=False)
p.add_mesh(data)
p.show(screenshot='foo.png') # USE EXIT BUTTON NOT Q KEY

which produces a blank image because I guess the renderer is destroyed before the screenshot code is executed:

foo

Colormap norming

Color mapping and scalar bar feature requests:

These requests stemmed from conversations with @prisae and @craigmillernz

Custom Colormaps

Can we implement a way for a user to make custom colormaps using matplotlib and send that map as the cmap argument? This should be as simple as adding in a type check and skipping over the colormap lookup code.

Update: implemented in #126

Categorical Colormaps

We also need a way to have categorical colormaps

Update: this is possible by using a custom built colormap from matplotlib

norm option

Also, could we add a new norm keyword argument similar to matplotlib? See this page. This would help users apply a standard matplotlib norm or center a color mapping around a value without changing the range. E.g "My data scale goes from -0.6 to 0.3 and I'd like the red/blue color map to be centered so that white is at 0."

@craigmillernz provided a super useful function for implementing this type of norm:

#Class to normalize colors to center around a value
from matplotlib.colors import Normalize

class MidpointNormalize(Normalize):
    def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):
        self.midpoint = midpoint
        Normalize.__init__(self, vmin, vmax, clip)

    def __call__(self, value, clip=None):
        # I'm ignoring masked values and all kinds of edge cases to make a
        # simple example...
        x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1]
        return np.ma.masked_array(np.interp(value, x, y))

Interactive colormaps

Could we maybe make a tool to create custom colormaps? This honestly might make the most sense to create a totally separate module under @OpenGeoVis. I'm thinking some sort of ipywidget or PyQt5 type interface where a user can harness to create a custom colormap. If we can get this going, then provide a way for it to like with vtki and update the mappers so a user can interactively update the rendering scene while changing the colormap.

Here is an example from @prisae in MatLab:

Peek 2019-03-11 09-00

Area and volume for each mesh cell

Dear Alex,

it is possible to get the area for each cell of a cutting plane, or volume for each cell of a mesh? In particular, I want to get the average for a value over surface or volume.
Thank you for your time.
Regards,

Christian

Camera object with vtki.texture_map_to_plane

Hello, I am using the vtki for texture mapping and I also want to use the vtk.camera object with vtki. I have some questions:

  1. Is it possible to use vtki as regular vtk.polydata for texture mapping? I tried but it is showing a white board. My final goal is to capture the textured image from different camera position and focal length.
  2. Is there a more convenient way to build relation between the vtk and vtki package? I try extract the data from vtki object but it seems difficult.

Here is my code for texture mapping and the change of the camera position:

texture = vtki.load_texture(img_path)
obj = vtki.read(stl_path)
obj.texture_map_to_plane(inplace=True)
Mapper = vtk.vtkPolyDataMapper()
Mapper.SetInputData(obj)
Actor = vtk.vtkActor()
Actor.SetMapper(Mapper)

renderer = vtk.vtkRenderer()
renderer.AddActor(Actor)
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(renderer)

// The camera position code

iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

renWin.Render()
iren.Start()

Dynamically update scalar bars if data range changes

When updating a scalar array, the scalar bar is not updated if the data range is updated. For example:

This example is from #75

from threading import Thread
import time
import numpy as np
import vtk
import vtki

sphere = vtki.Sphere()
sphere.point_arrays['scalars'] = sphere.points[:, 2]

# points = vtki_ndarray(sphere.points, sphere)

cpos = [(-1.3410801252605407, -2.735564325598376, 1.3608119983788354),
        (0.0, 0.0, 0.0),
        (0.16724779351273428, 0.37216861144284896, 0.9129724531560762)]

plotter = vtki.BackgroundPlotter()
plotter.add_mesh(sphere, lighting=False, show_edges=True, scalars='scalars')
plotter.camera_position = cpos

# shrink sphere in the background
def shrink():
    for i in range(10):
        sphere.points *= 0.9
        # Update sclars
        sphere.point_arrays['scalars'] += np.random.rand(sphere.n_points)
        time.sleep(0.5)

thread = Thread(target=shrink)
thread.start()

Feature Proposal

We should add a way that the scalar bars can be updated automatically if their corresponding meshes' data ranges change.

We will likely need a way to disable this if the user wants to explicitly define the scalar range

Questions

To implement this, we'll need some sort of callback or observer that will fetch the data ranges for each array linked to a scalar bar. This could turn into quite a bit of overhead if we do this on every render call.... perhaps there is a way to link the VTK scalar bar to the Cell/Point data to listen for a Modified() call?

2D Delaunay Filter is misspelled

The 2D Delaunay filter on the vtki.PolyData class is misspelt as .delauney_2d which is inconsist with the spelling in VTK and the 3D Delaunay filter under vtki.DataSetFilters.

This is leading to confusion among new users.

Iโ€™m afraid this might not be a simple fix by refactoring since .delauney_2D filter has been around for a long time and other dependencies might call it.

Render window exaggeration

Is it possible to exaggerate an axis in a VTK rendering window? If so, could we implement a method to do so?

I ask because this is very common (almost necessary) for many geoscientific applications. Often we're dealing with 10s-100s of square kilometers in the lateral (XY-plane) while looking only in the 10s-100s of meters in the Z-direction. These proportions make visualization rather difficult and exaggeration would help significantly

Change LookUpTable in vtkInterface

I was checking and the LookUpTable (colormap) is hardcoded in vtkInterface. Is there any chance that we can change it?

Colormaps serve different purposes in different datasets and it would be nice to change. Furthermore, the rainbow colormap is considered to be suboptimal, see for example:

Borland, David, and Russell M. Taylor II. "Rainbow color map (still) considered harmful." IEEE computer graphics and applications 27.2 (2007): 14-17.

Input fields for Qt axes scaling dialog

Could we add input text (float) fields next to the sliders on the Qt scale axes dialog?

screen shot 2019-02-18 at 12 24 25 pm

It's currently quite difficult to achieve desired scales with the Qt dialog. It might look something like the vtki.ScaledPlotter IPython widgets:

screen shot 2019-02-18 at 12 27 01 pm

Is it possible to clear the added mesh?

Hello,
Is there any methods to clear the plotted mesh?
Once I call "add_mesh" method, I can't clear the mesh plotting.
I tried to call add_mesh method with dummy grid object but didn't help.

Overwrite should preserve PointData

At the moment it's not possible to pass the output of the PolyDataNormals filter to PolyData.Overwrite as with other functions in the PolyData class, as this doesn't preserve the PointData object.

Disable adding axes in examples

In [3]: examples.BeamExample()
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-3-f6334ffa27c4> in <module>()
----> 1 examples.BeamExample()

~\AppData\Roaming\Python\Python36\site-packages\vtkInterface\examples\examples.py in BeamExample()
    117     plobj.AddMesh(grid, scalars=d[:, 1], stitle='Y Displacement',
    118                   rng=[-d.max(), d.max()], colormap=colormap)
--> 119     plobj.AddAxes()
    120     plobj.SetCameraPosition(cpos)
    121     plobj.AddText('Static Beam Example')

~\AppData\Roaming\Python\Python36\site-packages\vtkInterface\plotting.py in AddAxes(self)
   1286     def AddAxes(self):
   1287         """ Add axes actor at origin """
-> 1288         raise Exception('Disabled')
   1289         pass  # causes segfault
   1290         # axes = vtk.vtkAxesActor()

Exception: Disabled

Orthographic Slicer

I'd like to implement a new orthographic slicer where I use a 2 by 2 multi-window plotter.

Features needed:

  • ability to enable a 2D perspective (3 of 4 renderers need to be 2D)
  • convenience methods for orienting camera to view certain planes (XY, XZ, YZ) (see #115)
  • capture scroll event for moving the slicing planes
  • ability to lock the camera view for a renderer so the user cannot change it (see #115)

Starting Point

import vtki
from vtki import examples

data = examples.load_uniform()
data.set_active_scalar('Spatial Cell Data')

slices = data.slice_orthogonal()

# Orthographic Slicer

p = vtki.Plotter(shape=(2,2), notebook=False)

p.subplot(1,1)
p.add_mesh(slices, clim=data.get_data_range())

p.subplot(0,0)
p.add_mesh(slices['XY'])
p.view_xy()
p.disable()

p.subplot(0,1)
p.add_mesh(slices['XZ'])
p.view_xz(negative=True)
p.disable()

p.subplot(1,0)
p.add_mesh(slices['YZ'])
p.view_yz()
p.disable()

p.show()

download

Goal

I want this to behave similarly to ParaView's orthographic slicer:

ezgif com-video-to-gif

Is there a way to load .stl file with finer detail

When initializing PolyData, it seems like there's some sampling on the original stl file. I wonder if there's a way to turn off the sampling, and get a very fine mesh of the original stl file as a numpy array

Remove GitHub Wiki page

We should remove the wiki page/examples (or move them to the docs).

The wiki cannot be tested via a CI and will be difficult to maintain.

Better time varying plotting

Description

There are a few examples of plotting time-varying data using vtki:

These examples are all a bit convoluted and difficult for new users to experiment with. I propose a new feature in the plotting code that will handle all the background threading nuances so that new users (and power users like myself) do not have to make sure old threads are cleaned up and everything will simply work.

Proposal

Perhaps we could create a new function on the plotters called run_update_thread(func, **kwargs) that will take a user-defined function and it's keyword arguments. Then vtki will handle setting up the background threads and managing them when they are no longer in use.

I'm thinking this is necessary because I have seen a few users try to use the background threads and then try to make a change and end up with numerous background threads that are still updating old plotters and eating up memory/resources (I also do this all the time and end up to restarting my kernel).

This type of feature would make sure any threads associated with a plotter are killed when the plotter is closed.

Psuedo-Code

Below is what I'm thinking this might look like. I'm also brainstorming ideas of how we could have a user define a loop statement and then tell vtki to run that loop making sure to use a defined time step between each iteration if desired.

import vtki
import numpy as np

x = np.arange(-10, 10, 0.25)
y = np.arange(-10, 10, 0.25)
x, y = np.meshgrid(x, y)
r = np.sqrt(x**2 + y**2)
z = np.sin(r)

# Create and structured surface
grid = vtki.StructuredGrid(x, y, z)
grid.point_array['foo'] = z.ravel()

# Creat a plotter object and set the scalars to the Z height
p = vtki.BackgroundPlotter()
p.add_mesh(grid)


def my_func():
    """My user defined function that will update the plotter"""
    nframe = 25
    for phase in np.linspace(0, 2*np.pi, nframe + 1)[:nframe]:
        grid.points[:,-1] = np.sin(r + phase)
        grid.point_array['foo'] = z.ravel()
    return None
        
# Now repeatedly run that function!
p.run_update_thread(my_func,  tstep=0.01)

Need feedback

I'm simply brainstorming what users might want/need and I'm hoping to solicit feedback.
For those of you who I know are interested in time-varying visualizations, what would you like to see?: @tomtomatron and @sgkang

Documentation Overhaul

The docs are looking pretty OK at the moment. To make the docs more friendly to new users as well as useful for power users, I propose the following restructure:

Contents:

  • Overview
    • vtki Overview
    • Why?
  • Getting Started
    • Installation
    • Basic API Usage & create Simple Datasets
  • Data Types (here we have a section dedicated to documenting the API for each class)
    • Common: (explain all VTK data structures that vtki wraps and why users might want to choose different mesh types for different problems. These notes will point to the respective vtki class docs)
    • Point Data
    • Point-Based Grids
    • Gridded Volumes
    • Multiple Block Datasets
  • Examples (migrate quick examples here and have a page for each example)
    • Quick Examples
      • A page for each quick example
    • Longer Examples
      • A page for several longer/more complicated problems. Perhaps we could encourage users to submit their own page?
  • Tools
    • Plotting (this needs to be overhauled with explanations)
      • Here we should provide lots of example on how to use all the different features the plotting module offers
    • Filters
    • IPython Tools
    • PyQT Interface
    • Utilities

PlotCurvature() takes at most 2 arguments (3 given)

Thank you very much for the vtkInterface, it is the best interface I have seen so far.

However, when running the following code, I observe error

import vtkInterface as vtki
import numpy as np

# Make data
x = np.arange(-10, 10, 0.25)
y = np.arange(-10, 10, 0.25)
x, y = np.meshgrid(x, y)
r = np.sqrt(x**2 + y**2)
z = np.sin(r)

# create and plot structured grid
grid = vtki.StructuredGrid(x, y, z)
grid.Plot()  # basic plot

# Plot mean curvature
grid.PlotCurvature()

as

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-9afe5b8e784d> in <module>()
     14 
     15 # Plot mean curvature
---> 16 grid.PlotCurvature()

/usr/local/lib/python2.7/dist-packages/vtkInterface/grid.pyc in PlotCurvature(self, curvtype, rng)
     68         """
     69         # extract surface and plot its curvature
---> 70         self.ExtractExteriorTri()[0].PlotCurvature(curvtype, rng)
     71 
     72     @property

TypeError: PlotCurvature() takes at most 2 arguments (3 given)

numpy type check failure

When running the demo for advanced numpy plotting from the docs http://vtkinterface.readthedocs.io/en/latest/index.html

I get the following error:
File "C:\Users\aniranjan\AppData\Local\Continuum\anaconda3\envs\py35\lib\site-packages\vtkInterface\plotting.py", line 1090, in AddArrows
pdata = vtkInterface.CreateVectorPolyData(cent, direction * mag)
File "C:\Users\aniranjan\AppData\Local\Continuum\anaconda3\envs\py35\lib\site-packages\vtkInterface\utilities.py", line 138, in CreateVectorPolyData
vcells.SetCells(npts, numpy_to_vtkIdTypeArray(cells, deep=True))
File "C:\Users\aniranjan\AppData\Local\Continuum\anaconda3\envs\py35\lib\site-packages\vtk\util\numpy_support.py", line 192, in numpy_to_vtkIdTypeArray
'Expecting a numpy.int32 array, got %s instead.' % (str(dtype)))
ValueError: Expecting a numpy.int32 array, got int64 instead.

The issue appears to be in numpy_to_vtkIdTypeArray(), or at least how it's called in AddArrows()->CreateVectorPolyData()->vtk.vtkCellArray().SetCells()

PyQt5 5.12 Crashing Unpredictably

Windows users are reporting crashes/segfaults on Windows with PyQt5 version 5.12.

Immediate solution of downgrading PyQt5 to version 5.11.3 works for now but we need a patch for this.

Edit: Travis is also reporting failures on Linux

Color bar not rendering on Windows OS

I have a Windows VM that I've been using to test a few things and I noticed I cannot get the color bars to render:

import vtki
from vtki import examples

dataset = examples.load_uniform()
dataset.plot(screenshot='foo-windows.png')

foo-windows

Notes

  • Python 3.6
  • Architecture: 64bit WindowsPE
  • VTK Version: 8.1.2

Creating a Conda recipe

I propose we get a conda build recipe up for vtki because of the headaches that Windows installations bring:

I've been running into trouble making vtki a dependency of my project PVGeo. When I run the Windows CI testing (AppVeyor) for the environment:

Environment: PYTHON_VERSION=3.6, CONDA=C:\Miniconda36; Platform: x86

The setup.py script for vtki tries to add VTK to the dependencies but it is unavailable for that build from pip, only from conda.

Collecting vtk (from vtki>=0.13.0->-r requirements.txt (line 9))
Could not find a version that satisfies the requirement vtk (from vtki>=0.13.0->-r requirements.txt (line 9)) (from versions: )
No matching distribution found for vtk (from vtki>=0.13.0->-r requirements.txt (line 9))

Perhaps we should change the setup.py script to always warn on windows? Or better yet, do you (@akaszynski) know how to setup conda build recipes?

I haven't been able to figure this out for myself but I beginning to see that conda recipes will be a necessity for projects depending on VTK.

Plotter.screenshot return options

Can we change the default behavior of what is returned on the Plotter.screenshot call when a filename is passed? Perhaps add an argument return_image=None that can be used to get the NumPy array of the image if a user wants it after saving the image?

It makes notebooks a bit messy in its current implementation:

screen shot 2019-02-11 at 2 16 31 pm

UpdateScalars not working

UpdateScalars do not add the scalar points to mesh , i.e., it doesn't call AddCellScalars or AddPointCellScalars. Due to this the scalar remains in the same initial state without being updated.

AddPointScalars allows to add vector data

It seems that the method AddPointScalars allows to add vector data. But this is not clear from the docs. I just tested it with the following snippet

import numpy as np
import vtkInterface

x = np.arange(-10, 10, 0.25)
y = np.arange(-10, 10, 0.25)
z = 0
x, y, z = np.meshgrid(x, y, z)
data = np.column_stack((x.flatten(), y.flatten(), x.flatten()))
grid = vtkInterface.StructuredGrid(x, y, z)
grid.AddPointScalars(data, "data")
grid.Write("test.vts")

I think that this can be useful info to add to the docs.

kwargs for plotting

We need streamlined kwargs for controlling all aspects of the plotter. Feedback on additional items to control would be appreciated!

Also, how these kwargs are used/passed around needs to be updated to be a bit easier/more intuitive to users familiar with matplotlib.

  • Axes Labels Plotter.add_bounds_axes

    • font: font_family
    • font size: font_size
    • bold/italic: bold, italic
    • color: color
    • tick location: ticks
    • numerical label format: fmt
    • number of ticks - not sure if this is possible
  • Scalar Bar Plotter.add_scalar_bar or p.add_mesh -> scalar_bar_args={}

    • title: title or stitle
    • number of labels: n_labels
    • font: font_family
    • font size: title_font_size, label_font_size
    • bold/italic: bold, italic
    • color: color
    • interactive: interactive
  • Control window parameters:

    • size of window: window_size on instantiation

General feature requests:

  • Make controlling the location of scalar bars easier. Implemented in #107

ImportError: DLL load failed

Hello i tried installing your package via pip (i'm running python 3.6.3 on anaconda) and got this error:


`runfile('C:/Users/Tomas/Desktop/teste.py', wdir='C:/Users/Tomas/Desktop')
Traceback (most recent call last):

File "", line 1, in
runfile('C:/Users/Tomas/Desktop/teste.py', wdir='C:/Users/Tomas/Desktop')

File "C:\Users\Tomas\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile
execfile(filename, namespace)

File "C:\Users\Tomas\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/Tomas/Desktop/teste.py", line 1, in
import vtkInterface

File "C:\Users\Tomas\Anaconda3\lib\site-packages\vtkInterface_init_.py", line 10, in
from vtkInterface.plotting import *

File "C:\Users\Tomas\Anaconda3\lib\site-packages\vtkInterface\plotting.py", line 12, in
from PIL import Image

File "C:\Users\Tomas\Anaconda3\lib\site-packages\PIL\Image.py", line 56, in
from . import _imaging as core

ImportError: DLL load failed: The specified module could not be found.`


Can't figure out why i'm getting this error, as i've vtk installed (vtk 8.1.0).
Can you help me out?

OS: Windows 10

BackgroundPlotter Menu Items

In the qt plotter example in the docs, a menubar and menu item to add datasets to the render window is created. Could we do this for the Background plotter and implement a few methods that make calls to the Plotter?

I'm thinking it would be useful to have at least:

  • A File menu:
    • Option to take a screenshot with pop dialog for the filename
  • A View menu:
    • Option to reset the camera (calls plotter.reset_camera)
    • Option to use the default camera position (calls plotter.isometric_view after #43 is merged)
    • Maybe a way to save camera positions and reselect them?
    • Ability to scale axes if #39 is possible (calls plotter.set_scale after #43 is merged)

Cube Axes Padding

We definitely need to add a way to pad the cube axes actor. Especially when using scaled scenes where we need to use the 2D mode on the cube axes actor. See image below for issue:

...
p.set_scale(zscale=3.0)
p.show_grid()
p.show()

download

multi-window plotting: isolate click events

Can we isolate click events to each renderer in the multi-plotting view? For example, if on click on one renderer to rotate the camera, as soon as you cross the boundary into the other renderer, it starts rotating the other window.

import vtki
from vtki import examples

p = vtki.Plotter(shape=(1,2), notebook=False)

p.subplot(0,0)
p.add_mesh(examples.load_airplane())

p.subplot(0,1)
p.add_mesh(examples.load_globe())

p.show()

ezgif com-video-to-gif

PolyData from vertices and faces not working - either crashes or shows nothing

  • Windows 10
  • python 3.6.4 (anaconda)
  • VTK version 8.1.1 (pip)
  • vtkInterface 0.9.3 (pip)

When I attempt to use PolyData with vertices and faces I either get a segfault style crash or for some simple demos I get an empty VTK render window.

For example, the code on this page: https://vtkinterface.readthedocs.io/en/latest/polydata.html:

import numpy as np
import vtkInterface

# mesh points
vertices = np.array([[0, 0, 0],
                     [1, 0, 0],
                     [1, 1, 0],
                     [0, 1, 0]])

# mesh faces
faces = np.hstack([[4, 0, 1, 2, 3],  # square
                   [3, 0, 1, 4],     # triangle
                   [3, 1, 2, 4]])    # triangle

surf = vtkInterface.PolyData(vertices, faces)

# plot each face with a different color
surf.Plot(scalars=np.arange(3))

Just gives me an empty render window.

The following example segfaults:

import vtkInterface
import numpy as np
from vtkInterface import PolyData

verts = np.array([[0, 0, 0],
                  [0, 0, 1],
                  [0, 1, 0],
                  [1, 0, 1]], dtype=np.float64)
faces = np.array([[0, 1, 2],
                  [1, 2, 3]], dtype=np.int64)
pd = PolyData(verts, faces)
pd.Plot()

When I follow the debugger it's the PolyData.SetPolys() line that causes the crash.

Just to be clear... if I instead build the triangles one at time using pure vtk it works fine.

import numpy as np
import vtk

verts = np.array([[0, 0, 0],
                  [0, 0, 1],
                  [0, 1, 0],
                  [1, 0, 1]], dtype=np.float64)
faces = np.array([[0, 1, 2],
                  [1, 2, 3]], dtype=np.int64)

points = vtk.vtkPoints()
triangles = vtk.vtkCellArray()

for i, tri in enumerate(faces):
    p1 = verts[tri[0]]
    p2 = verts[tri[1]]
    p3 = verts[tri[2]]
    points.InsertNextPoint(*p1)
    points.InsertNextPoint(*p2)
    points.InsertNextPoint(*p3)

    triangle = vtk.vtkTriangle()
    triangle.GetPointIds().SetId(0, 3 * i + 0)
    triangle.GetPointIds().SetId(1, 3 * i + 1)
    triangle.GetPointIds().SetId(2, 3 * i + 2)
    triangles.InsertNextCell(triangle)

polydata = vtk.vtkPolyData()
polydata.SetPoints(points)
polydata.SetPolys(triangles)

mapper = vtk.vtkDataSetMapper()
mapper.SetInputData(polydata)
actor = vtk.vtkActor()
actor.SetMapper(mapper)

renderer = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(renderer)
iren = vtk.vtkRenderWindowInteractor()
iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
iren.SetRenderWindow(renWin)
renderer.AddActor(actor)
renWin.SetSize(640, 480)
renWin.Render()

renWin.Render()
iren.Start()

Any ideas?

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.