如何在 python 中可视化 3D 数组(内核)?

问题描述 投票:0回答:0

我正在尝试用 python 可视化 3D 内核,我使用了“mayavi”,但我可以安装“wxPython”,还有其他库可以帮助我吗?

kernel = np.array([[[0.88121283, 0.91759044, 0.5578005 ],
              [0.91488576, 0.9526534 , 0.5791151 ],
              [0.88121283, 0.91759044, 0.5578005 ]],

             [[0.88369477, 0.9201748 , 0.5593715 ],
              [0.91746247, 0.9553365 , 0.5807462 ],
              [0.88369477, 0.9201748 , 0.5593715 ]],

             [[0.88121283, 0.91759044, 0.5578005 ],
              [0.91488576, 0.9526534 , 0.5791151 ],
              [0.88121283, 0.91759044, 0.5578005 ]]])

这是我写的代码

from mayavi import mlab
mlab.volume_slice(kernel, plane_orientation='x_axes', slice_index=3)
mlab.volume_slice(kernel, plane_orientation='y_axes', slice_index=3)
mlab.volume_slice(kernel, plane_orientation='z_axes', slice_index=3)
mlab.show()

mlab.contour3d(kernel)
mlab.show()

“mayavi”需要“wxPython”,但我无法安装。我累了 pip 安装 attrdict3 pip 安装请求 pip 安装 wxpython 我收到这个错误:

Building wheels for collected packages: wxpython
  error: subprocess-exited-with-error
  
  × python setup.py bdist_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.
  Building wheel for wxpython (setup.py) ... error
  ERROR: Failed building wheel for wxpython
  Running setup.py clean for wxpython
Failed to build wxpython
Installing collected packages: wxpython
  error: subprocess-exited-with-error
  
  × Running setup.py install for wxpython 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.
  Running setup.py install for wxpython ... error
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> wxpython

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
python 3d visualization mayavi mayavi.mlab
© www.soinside.com 2019 - 2024. All rights reserved.