对于简单的科学可视化3D有什么轻量级Python库有什么、简单、科学、Python

由网友(我的锁屏密码是他的名字)分享简介:我写一个程序在Python进行实验的学术思想。看着所得图像的程序产生:I am writing a program in python to experiment an academic idea. Look at a resultant image the program generates:在叶的中间的厚骨架线...

我写一个程序在Python进行实验的学术思想。看着所得图像的程序产生:

I am writing a program in python to experiment an academic idea. Look at a resultant image the program generates:

在叶的中间的厚骨架线是什么需要被可视化。骨架线的每一个部分都有一个与之关联的值,在上面的图片,用于可视化的灰色深浅不同的(由 pycairo 绘制),颜色较浅意味着更高值,黑线表示该行有0值与之相关联。问题是使用颜色在这种情况下的可视化是非常直观的人的眼睛,这将是更好的可视化在三维中的值,如以下的(从纸采取):

The thick skeleton lines in the middle of the leaf is what need to be visualized. Every segment of the skeleton lines has a value associated with it, in the above image (drawn by pycairo), different shades of gray are used for visualization, the lighter color means higher value, black lines indicate the lines have value 0 associated with them. The problem is visualization using colors in this case is very unintuitive for human eyes, it would be much better to visualize the values in 3D like the following (taken from a paper):

左图像是正确的一个三维可视化,与线路相关联的值被可视化为连续壁在三​​维高度

the left image is a 3D visualization of the right one, the values associated with the lines are visualized as height of consecutive walls in 3D.

什么是做到这一点的最好的图书馆吗?我不想太多的时间来投入到这样做,这样一个轻量级的库是preferred。

What is the best library to do this? I don't want to invest much time into doing this, so a lightweight library is preferred.

推荐答案

如果你想轻便,那么你可以使用 PyOpenGL 刚换的OpenGL在python直接调用。这可能是最轻重量的选择。

If you want lightweight, then you can use PyOpenGL to just wrap OpenGL calls in python directly. This is probably the lightest-weight option.

如果你想很多的功能,我建议你使用 VTK 。这是一个非常强大的可视化工具包,Python包装(含税)。有建立在此之上(如Mayavi中和的Paraview)其他包,但VTK单独的包装往往更容易使用。这很可能是我的第一选择,因为他们可以用一些很好的样本 - 所有你需要做的就是让一个VtkPolyData实例,并把它在渲染

If you want lots of features, I'd recommend using VTK. It's a very powerful visualization toolkit with Python wrappers (included). There are other packages built on top of this (such as Mayavi and Paraview), but the VTK wrappers alone are often easier to use. This would probably be my first choice, since they have some good samples you can use - all you'd need to do is make a VtkPolyData instance, and throw it in a renderer.

话虽这么说,为便于开发,你可能想要的东西,简化了这个给你,如包装为一个轻量的渲染引擎喜欢的 Irrlicht的通过 Pyrr 。这使得它更容易产生的图像。

That being said, for ease of development, you might want something that simplifies this for you, such as wrappers for a light-weight rendering engine like Irrlicht via Pyrr. This makes it much easier to generate the picture.

阅读全文

相关推荐

最新文章