简体   繁体   English

使用 SimpleITK 进行图像分割和配准

[英]Image segmentation and registration using SimpleITK

I have some doubts regarding 3D image registration and segmentation:我对3D图像配准和分割有一些疑问:

  1. Load dicom images: In DCE-MRI there are 4000 slices and total 100 stacks, so 40 in each stack.加载 dicom 图像:在 DCE-MRI 中,有 4000 个切片,总共 100 个堆栈,因此每个堆栈中有 40 个。 How can I load them to a 4D array using GDCM simpleITK function如何使用 GDCM simpleITK 函数将它们加载到 4D 阵列

  2. Registration: registration is pretty straight forward, we have to register all 100 stacks to the first stack.注册:注册非常简单,我们必须将所有 100 个堆栈注册到第一个堆栈。

  3. Registration accuracy : SimpleITK overlap ratio measure or hausdroff distance need segmentation and labelling.配准精度:SimpleITK 重叠率测量或 hausdroff 距离需要分割和标记。 Now segmentation using region growing or thresholding is not easy for all kind of images.现在,对于所有类型的图像,使用区域增长或阈值进行分割并不容易。 Let suppose I just want to select a region manually , interactively.假设我只想以交互方式手动选择一个区域。 Is it possible to achieve that ?有可能实现吗? Then I just want to use that selected mask for registration accuracy evaluation.然后我只想使用选定的掩码进行注册准确性评估。

  4. Visualization and write : need to visualize in 3D using matplotlib or VTK.可视化和编写:需要使用 matplotlib 或 VTK 进行 3D 可视化。 All plot functions are working for 2d slice, again visualizing in 2D is not desired.所有绘图函数都适用于 2d 切片,同样不需要在 2D 中进行可视化。 While writing to a dicom image using simpleITK write Image function, for dicom image just writing the image object is not working.使用 simpleITK write Image 函数写入 dicom 图像时,对于 dicom 图像,仅写入图像对象是行不通的。 We need to change type to UInt32 , but then the image becomes lossy.我们需要将 type 更改为 UInt32 ,但是图像会变得有损。 It successfully writes to a .mha format, but imageJ fails to display.它成功写入 .mha 格式,但 imageJ 无法显示。

If possible please share your thoughts.如果可能,请分享您的想法。

I am not sure whether SimpleITK supports 4D images in its default configuration.我不确定 SimpleITK 是否在其默认配置中支持 4D 图像。 If not, you would have to compile it yourself, after having it configured to support dimension 4 (and not just 2 and 3).如果没有,您必须自己编译它,然后将其配置为支持维度 4(而不仅仅是维度 2 和维度 3)。 Even with that, I am not sure it would work right away - DICOM is notorious making simple things not so easy, and complicated things super-hard.即使这样,我也不确定它是否会立即起作用 - DICOM 臭名昭著,使简单的事情变得不那么容易,而使复杂的事情变得非常困难。

ITK-SNAP is a tool for manual and manually assisted segmentation. ITK-SNAP是一种用于手动和手动辅助分割的工具。

Visualization is more a VTK question.可视化更像是一个 VTK 问题。 Here is an example which uses 3D visualization.这是一个使用 3D 可视化的示例

1) GetImageFromArray, simpleITK in python> convert a 4d numpy array to a SimpleITK image. 1) GetImageFromArray, python 中的 simpleITK> 将 4d numpy 数组转换为 SimpleITK 图像。

import numpy as np
import SimpleITK as sitk

np_array = np.zeros( (a,b,c,d) )
tdim = np_array.shape[3]
slices = []

for i in range(tdim):
    slices.append( sitk.GetImageFromArray( np_array[i], False ) )

im = sitk.JoinSeries(slices)

sitk.WriteImage(im, "imageresult.mha") 

2) You can first select you VOI using ITKsnap, or in your python code and instead of performing all your experiments on the whole image data, you can only include that ROI. 2)您可以首先使用 ITKsnap 或在您的 Python 代码中选择您的 VOI,而不是对整个图像数据执行所有实验,您只能包括该 ROI。

3) use> from myshow import myshow 3) 使用> from myshow import myshow

myshow(sitk.LabelToRGB(img), title='img')

3D Slicer has functionality to load DCE MRI series as 4D volumes. 3D Slicer具有将 DCE MRI 系列加载为 4D 体积的功能。 You can find the tutorial how to use this functionality of 3D Slicer in this post: https://discourse.slicer.org/t/how-to-analyze-dce-mri-data/622 .您可以在这篇文章中找到如何使用 3D Slicer 的此功能的教程: https : //discourse.slicer.org/t/how-to-analyze-dce-mri-data/622

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

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