This tutorial was co-authored by xieliaokc and liaoweiyang2017. If you have any questions, please contact [email protected].
本教程是由xieliaokc和liaoweiyang2017共同撰写,如果你有任何疑问请联系[email protected]。
We recommend using
Anacondato manage your Python environment, andMambafor faster package installation. The commands below are based onAnacondaandMamba.
-
First, download the
Mambaforgepackage from the Mamba download page. Choose the version that matches your system.Mambaforgeis a minimal conda distribution that includes bothMambaandconda. After downloading, install it with:bash Miniforge3-Linux-x86_64.sh -b -p ${HOME}/mambaforge -
Next, add
Mambaandcondato yourPATHby editing your~/.bashrcfile. Add the following lines to the end of the file:vim ~/.bashrc # conda if [ -f "${HOME}/mambaforge/etc/profile.d/conda.sh" ]; then source "${HOME}/mambaforge/etc/profile.d/conda.sh" fi # mamba if [ -f "${HOME}/mambaforge/etc/profile.d/mamba.sh" ]; then source "${HOME}/mambaforge/etc/profile.d/mamba.sh" fi
-
You can alias the
condacommand tomambafor convenience. Add this line to your~/.bashrcfile:vim ~/.bashrc alias conda=mamba
-
Now, create the
pyvistaenvironment with the following commands:# create the pyvista environment using Python version 3.9 mamba create -n pyvista python=3.9 mamba activate pyvista # install packages pip install matplotlib numpy pip install pyvista jupyter notebook # install Google Drive support for downloading provided datasets pip install gdown
-
We recommend using
vscodeto run.ipynbnotebook files. You can open theipynbfiles directly withvscode.
- Enhancing the Use of Scripting for 3D Visualization: This tutorial aims to assist users in better utilizing scripts to create 3D volumes and various slices. This method is more efficient and repeatable compared to traditional manual operations, especially for complex visualization requirements.
- Offering a Free and Precise Alternative: In contrast to commercial software like
Voxleror the open source softwareParaView, which often require manual adjustments and lack precision, this tutorial usesPyVistato provide a free, open-source solution that allows users to precisely control the visualization process. - Emphasizing the Spirit of Open Source and Sharing: The tutorial embraces the spirit of open-source and sharing, intending to help more people gain proficiency in professional tools and to promote the dissemination and exchange of technical knowledge.
我们推荐使用
Anaconda来管理 Python 环境,并使用Mamba来加速软件包的安装。以下命令基于Anaconda和Mamba。
-
首先,从 Mamba 下载页面 下载
Mambaforge包。请选择与你的系统匹配的版本。Mambaforge是一个包含Mamba和conda的简化 conda 发行版。下载后,可以用以下命令安装:bash Miniforge3-Linux-x86_64.sh -b -p ${HOME}/mambaforge -
接下来,通过编辑
~/.bashrc文件,将Mamba和conda添加到你的PATH。在文件末尾添加以下行:vim ~/.bashrc # conda if [ -f "${HOME}/mambaforge/etc/profile.d/conda.sh" ]; then source "${HOME}/mambaforge/etc/profile.d/conda.sh" fi # mamba if [ -f "${HOME}/mambaforge/etc/profile.d/mamba.sh" ]; then source "${HOME}/mambaforge/etc/profile.d/mamba.sh" fi
-
为方便起见,可以将
conda命令别名为mamba。在~/.bashrc文件中添加这一行:vim ~/.bashrc alias conda=mamba
-
现在,可以使用以下命令创建
pyvista环境:# 使用 Python 版本 3.9 创建 pyvista 环境 mamba create -n pyvista python=3.9 mamba activate pyvista # 安装软件包 pip install matplotlib numpy pip install pyvista jupyter notebook # 安装 Google Drive 支持以下载提供的数据集 pip install gdown
-
我们建议使用
vscode来运行.ipynb笔记本文件。你可以直接用vscode打开ipynb文件。
- 促进三维绘图脚本的应用:本教程旨在帮助大家更好地使用脚本来绘制三维体图和各种切片。这种方法较传统手动操作更高效和可重复,适合更批量化等复杂的可视化需求。
- 提供免费、精准的替代方案:相比商业付费软件如
Voxler及开源软件ParaView,这些软件常需要手动调节且不够精准,本教程将通过PyVista提供一个免费的开源解决方案,使用户能够精确控制可视化过程。 - 支持开源共享精神:本教程秉持开源共享的精神,希望帮助更多人掌握专业工具,并促进技术知识的传播和交流。