Python 中的 3D Dicom 可视化 [英] 3D Dicom Visualisation in Python

查看:48
本文介绍了Python 中的 3D Dicom 可视化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 3D 图像处理的新手.我想知道如何在python中查看dicom系列.我尝试使用 matplotlib 和 VTK.在 matplot 中,我无法像使用 volViewer 在 matlab 中查看那样查看体积.关于 VTK,我无法导入 VTKRAyCASt 来查看 3D.我用的版本是8.2.0.

我正在使用 scipy.ndimages 进行处理

请为我的音量 dicom 文件推荐一些资源

解决方案

你可以试试 ipyvolume

I am new to 3D image processing . I would like to know how to view the dicom series in python. I tried using matplotlib and VTK. In matplot I am not able to view the volume like I view in matlab using volViewer. Regarding VTK I am not able to import VTKRAyCASt for viewing 3D. The version I am using is 8.2.0.

I am doing the processing using scipy.ndimages

Kindly suggest me some resources to my volume dicom files

解决方案

You can try ipyvolume https://github.com/maartenbreddels/ipyvolume for interactive plotting, I found it quite useful. Also, you can plot them with matplotlib by using marching cubes to obtain the surface mesh but it is quite slow though:

from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import numpy as np
from skimage import measure

def plot_3d(image, threshold=-300): 
    p = image.transpose(2,1,0)
    verts, faces, normals, values = measure.marching_cubes_lewiner(p, threshold)
    fig = plt.figure(figsize=(10, 10))
    ax = fig.add_subplot(111, projection='3d')
    mesh = Poly3DCollection(verts[faces], alpha=0.1)
    face_color = [0.5, 0.5, 1]
    mesh.set_facecolor(face_color)
    ax.add_collection3d(mesh)
    ax.set_xlim(0, p.shape[0])
    ax.set_ylim(0, p.shape[1])
    ax.set_zlim(0, p.shape[2])

    plt.show()

The threshold of -300 HU is fine for visualizing chest CT scans but change it if you going to use MRI (check your intensity values distribution) or binary volumes (threshold =0).

There is some example of visualization:

这篇关于Python 中的 3D Dicom 可视化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆