View your 3D numpy arrays in Blender3D. 4D on the way.
All Lung CT scan data from RIDER Lung CT dataset: https://wiki.cancerimagingarchive.net/display/Public/RIDER+Lung+CT
Install Blender3D: a 3D graphics software that can view vdb files
- Install Blender3D 2.83 from https://blender.org.
Install OpenVDB
- If you can use docker, install pyopenvdb from instructions on https://github.com/theNewFlesh/docker_pyopenvdb and call it done.
- If dockder is not an option, (no root or other container service), conda works sometimes...
conda create --name vdbenv python=3.7
which pip
Should be the pip under your vdb environment folder.pip install python-dev-tools pyopenvdb
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/
Find this folder viafind $CONDA_PREFIX -name libpython3.7m.so.1.0
.export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/python3.7/site-packages/
. Find this folder viafind $CONDA_PREFIX -name pyopenvdb.so
.- Run steps 6 and 7 whenever you create a new terminal, or enter the environment. In a future version, it would be great to make this part automatic.
These steps have installed openvdb on a machine running Ubuntu 18.04.4 LTS.
Blender Volumetrics Rendering requires a lot of resourses, so you'll likley need a high end NVIDIA gpu.
Run python ./npy-viewer xxxxx.npy yyyyy.npz nnnnn.npy
to view 3D arrays stored in correspoinding .npy/.npz files.
Here, instead of a shebang, the python specified on the commandline is used. This assumes you have activated your vdb environment
Note that to simply convert a npy to a vdb, a tmpdir is created on run, which contains the vdb used by blender.
Blender is used to view a vdb version of the npy.
Middle click can be used to orbit the vdb.
Hold shift to pan.
Press z and select render to see the full visualization.