How visualize 3D images without using paraview #557
jgostick
announced in
Tips and Tricks
Replies: 3 comments 3 replies
-
I have just learned that matplotlib has a import porespy as ps
import matplotlib.pyplot as plt
im = ps.generators.blobs(shape=[50, 50, 50])
ax = plt.figure().add_subplot(projection='3d')
ax.voxels(im)
plt.show() Produces something like this: |
Beta Was this translation helpful? Give feedback.
1 reply
-
Just discovered Vedo, wow! There is a function for voxel display, with an example here. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Here is a recipe using open3d: import open3d as o3d
pcd = o3d.geometry.PointCloud()
xyz = np.vstack(np.where(~im)).T
pcd.points = o3d.utility.Vector3dVector(xyz)
pcd.colors = o3d.utility.Vector3dVector(np.random.rand(*xyz.shape))
voxel_grid = o3d.geometry.VoxelGrid.create_from_point_cloud(pcd, voxel_size=1)
o3d.visualization.draw_geometries([voxel_grid]) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There are many external programs for viewing 3D images. We like to use Paraview since it can open a 3D tiff image with no issues, and offers ray-tracing which looks great. But it can be a pain to switch programs to see if an image is looking as expected. There is an exciting new project called Napari, which is a python package for viewing 3D images, and it can be called directly from the ipython command line. I have been playing with this a bit and cooked up the following recipe which may be helpful to people:
Beta Was this translation helpful? Give feedback.
All reactions