简体   繁体   English

使用VTK构建DICOM图像分割和3d

[英]DICOM Image segmentation and 3d construction using VTK

I am working on.dcm image (dicom image)我正在处理.dcm 图像(dicom 图像)

In my case there are 152 2D image slices.在我的例子中,有 152 个 2D 图像切片。

I have used https://www.raddq.com/dicom-processin ... link for segmentation.我已经使用https://www.raddq.com/dicom-processin ... 链接进行分段。 After segmentation, i used region of interest(ROI) on that segmented area.分割后,我在该分割区域上使用了感兴趣区域(ROI)。

Now i have parameters x,y,w,h and crop image which is getting from ROI.现在我有参数 x,y,w,h 和从 ROI 获取的裁剪图像。

I want to visualize this segmented data in 3D using VTK library with python.我想使用带有 python 的 VTK 库在 3D 中可视化这些分段数据。

Is there any way to visualize this data.有什么方法可以可视化这些数据。 I am confused what will be the function and parameters of vtk.我很困惑 function 和 vtk 的参数是什么。

Looking at that tool, the output of segmentation is stored as a numpy array.查看该工具,分割的 output 存储为 numpy 数组。 In order to use common image visualization tools, you need to store that array into a more generic 3D format.为了使用常见的图像可视化工具,您需要将该数组存储为更通用的 3D 格式。

You could useSimpleITK or itk-python to import numpy array into an ITK image.您可以使用SimpleITKitk-python将 numpy 数组导入 ITK 图像。 You can find the specific recipe how to do this and store the result into a file here: https://itkpythonpackage.readthedocs.io/en/latest/Quick_start_guide.html#mixing-itk-and-numpy .您可以在此处找到如何执行此操作的特定配方并将结果存储到文件中: https://itkpythonpackage.readthedocs.io/en/latest/Quick_start_guide.html#mixing-itk-and-numpy

One thing that will be missing in the file you save is the geometry information about the image.您保存的文件中将缺少的一件事是有关图像的几何信息。 Probably the easiest way to address this is to first convert the input DICOM image series into 3D format (you can do this using dcm2niix that will store the resulting volume as NIfTI), load that volume into Python using the aforementioned SimpleITK or itk-python, which will also give you the option to export the loaded image into a numpy array.解决此问题的最简单方法可能是首先将输入的 DICOM 图像系列转换为 3D 格式(您可以使用dcm2niix执行此操作,它将结果卷存储为 NIfTI),使用上述 SimpleITK 或 itk-python 将该卷加载到 Python 中,这还可以让您选择将加载的图像导出到 numpy 数组中。 If you start with that array for your segmentation task, the arrangement of voxels in the segmentation numpy array will be the same as in the image numpy array.如果您从该数组开始进行分割任务,则分割 numpy 数组中的体素排列将与图像 numpy 数组中的体素排列相同。 So when you export numpy array into a SimpleITK or itk-python image, you can copy image geometry to initialize segmentation geometry (you will need to use Get/SetDirection , Get/SetSpacing and Get/SetOrigin ).因此,当您将 numpy 数组导出到 SimpleITK 或 itk-python 图像时,您可以复制图像几何体以初始化分割几何体(您将需要使用Get/SetDirectionGet/SetSpacingGet/SetOrigin )。

Once you store it in a file, you can use tools such as 3D Slicer to load the original DICOM image series, and overlay segmentation results.将其存储在文件中后,您可以使用3D Slicer等工具加载原始 DICOM 图像系列,并叠加分割结果。

Unfortunately, it's a lot of steps, and I understand this will be confusing.不幸的是,这是很多步骤,我知道这会令人困惑。 But hope it will help you get started!但希望它能帮助您入门!

In addition to @user3216191's suggestion, you could take a look at itkwidgets :除了@user3216191 的建议,您还可以看看itkwidgets

https://github.com/InsightSoftwareConsortium/itkwidgets https://github.com/InsightSoftwareConsortium/itkwidgets

It is a Python package enables you to volume render a 3d image in a Jupyter notebook.它是 Python package 使您能够在 Jupyter 笔记本中体积渲染 3d 图像。 It can take as input ITK image, a numpy array or some other 3d image formats.它可以将 ITK 图像、numpy 数组或其他一些 3d 图像格式作为输入。 It will also render 3d meshes in VTK or ITK mesh formats.它还将以 VTK 或 ITK 网格格式渲染 3d 网格。

I don't know if it will volume render both your original image and your segmentation.我不知道它是否会同时渲染您的原始图像和分割。 So you could extract an isosurface of the segmentation and display that with a volume rendering of the original image.因此,您可以提取分割的等值面并将其显示为原始图像的体积渲染。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM