我正在使用SimpleITK的VectorConfidenceConnectedImageFilter
。当提供多个种子时,我对它的行为感到困惑。
我正在进行胆管的3D分割。首先,我使用SVM(成对耦合)获得概率图。然后我得到228分,概率大于0.999999。使用这228个点作为种子,我从VectorConfidenceConnectedImageFilter
得到了什么。顺便说一句,228种子可能位于彼此非常接近的位置。以下是一些种子。
Seed information:
Seed_index Seed_x_y_z prob CT_value_a CT_value_b
0, (161, 241, 163), 0.9999991059303284, 24, 19
1, (161, 242, 163), 0.9999989867210388, 33, 23
2, (203, 215, 164), 0.999999463558197, 3, 7
3, (161, 241, 164), 0.9999989867210388, 28, 22
4, (162, 242, 164), 0.9999989867210388, 35, 24
5, (161, 241, 165), 0.9999991059303284, 27, 22
6, (162, 241, 165), 0.9999992847442627, 30, 25
7, (162, 242, 165), 0.9999992251396179, 31, 22
8, (162, 242, 166), 0.9999991059303284, 33, 27
9, (165, 241, 169), 0.9999992251396179, 24, 26
10, (166, 241, 170), 0.9999994039535522, 12, 25
11, (166, 242, 170), 0.9999996423721313, 15, 19
12, (167, 242, 170), 0.9999997019767761, 14, 22
13, (165, 243, 170), 0.9999990463256836, 15, 20
14, (166, 243, 170), 0.9999996423721313, 13, 20
15, (167, 243, 170), 0.9999991655349731, 21, 16
16, (166, 241, 171), 0.9999995827674866, 11, 19
17, (167, 241, 171), 0.9999996423721313, 7, 23
18, (166, 242, 171), 0.9999992251396179, 7, 14
19, (167, 242, 171), 0.9999998211860657, 11, 13
20, (168, 242, 171), 0.9999997615814209, 12, 19
21, (168, 243, 171), 0.9999991059303284, 16, 11
22, (150, 297, 171), 0.9999990463256836, 61, 56
23, (149, 208, 172), 0.9999992847442627, 45, 38
24, (149, 209, 172), 0.999999463558197, 45, 35
25, (167, 240, 172), 0.9999989867210388, 13, 28
26, (166, 241, 172), 0.9999993443489075, 10, 19
27, (167, 241, 172), 0.9999992251396179, 9, 13
...
使用前25个种子时的协方差矩阵:
Covariance matrix:
[[ nan nan nan]
[ nan nan nan]
[ nan nan nan]]
如何在协方差矩阵中得到nan
?
然后我尝试使用更少的种子。 使用前5个种子我可以得到一些分割结果。使用前20个种子我也可以得到一些分割结果。分割区域看起来较小,但不是先前分割区域的子集。当我使用前25个种子时,我没有被分割。
这怎么可能发生?
不应该是更多的种子,越来越大的成长区域?
顺便说一句,numberOfIterations
和multiplier
的设置始终相同。
numberOfIterations=4, multiplier=3.5
我阅读了文档(https://itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1VectorConfidenceConnectedImageFilter.html#details),但没有发现任何解释这一点。
PS:
我想分割的是胆管。当输出正常时,分段区域将标记为值1.通过“输出无效”,我的意思是所有体素,即使是我用作种子的体素,都标记为0,因此没有任何分段。< / p>
过滤器的官方解释是针对单个种子点的情况。输入多个种子点时会发生什么?我输入2个种子并改变他们的顺序。我发现输入种子的顺序很重要。输出分段区域与第一个种子连接,但可能不与第二个种子连接。
我想限制种子的数量,并希望该地区从最值得信赖的地方成长。所以我使用0.999999来阈值种子点。实际上,使用前5种子的输出是真正有希望的。但我不知道为什么更多的种子,输出区域变小(但不是子集)。
将参数更改为
后numberOfIterations=2, multiplier=2.5
使用前25个种子就行了。但是,分段结果比我想要的要大得多。几乎1/2的输出音量标记为1。
PS2(按@blowekamp的建议添加): 参数设置:
seed_vol = sitk.Image(seg.GetSize(), sitk.sitkUInt8)
seed_vol.CopyInformation(seg)
for seed in seeds_xyz[0:25]:
seed_vol[seed] = 1
filter = sitk.VectorConfidenceConnectedImageFilter()
filter.SetSeedList(seeds_xyz[0:25])
filter.SetMultiplier(2.5)
stat_filter = sitk.LabelStatisticsImageFilter()
for iteration in range(0,5):
filter.SetNumberOfIterations(iteration)
seg = filter.Execute(img_multi)
print("Number of iteration: {0}".format(iteration))
print("Mean from VectorConfidenceConnectedImageFilter: {0}".format(filter.GetMean()))
print("Covariance matrix from VectorConfidenceConnectedImageFilter:")
print((nine_ele_list_to_matrix(filter.GetCovariance())))
stat_filter.Execute(predicted_prob_vol, seg)
print("Mean from LabelStatisticsImageFilter for grown output: {0}".format(stat_filter.GetMean(1)))
print("Covariance from LabelStatisticsImageFilter for grown output: {0}".format(stat_filter.GetVariance(1)))
print("The labels: {0}. Label count of statistics filter: {1}".format(stat_filter.GetLabels(), stat_filter.GetNumberOfLabels()))
stat_filter.Execute(predicted_prob_vol, seed_vol)
print("Mean from LabelStatisticsImageFilter for seeds: {0}".format(stat_filter.GetMean(1)))
print("Covariance from LabelStatisticsImageFilter for seeds: {0}".format(stat_filter.GetVariance(1)))
print()
输出:
Number of iteration: 0
Mean from VectorConfidenceConnectedImageFilter: (0.9623870230024614, 31.73925925925926, 25.998518518518512)
Covariance matrix from VectorConfidenceConnectedImageFilter:
[[ 1.82135131e-02 -7.92697795e-01 -3.38983449e-01]
[ -7.92697795e-01 1.18911385e+02 5.24617833e+01]
[ -3.38983449e-01 5.24617833e+01 4.07701509e+01]]
Mean from LabelStatisticsImageFilter for grown output: 0.8556543207298526
Covariance from LabelStatisticsImageFilter for grown output: 0.029425739235467253
The labels: (0, 1). Label count of statistics filter: 2
Mean from LabelStatisticsImageFilter for seeds: 0.9999993205070495
Covariance from LabelStatisticsImageFilter for seeds: 7.25345709421769e-14
Number of iteration: 1
Mean from VectorConfidenceConnectedImageFilter: (0.8556543207298526, 28.868118168903834, 20.2249441915751)
Covariance matrix from VectorConfidenceConnectedImageFilter:
[[ 2.94248861e-02 -9.82479976e-01 -5.38478238e-01]
[ -9.82479976e-01 3.63929118e+02 2.06866705e+02]
[ -5.38478238e-01 2.06866705e+02 1.56397694e+02]]
Mean from LabelStatisticsImageFilter for grown output: 0.03871633721462062
Covariance from LabelStatisticsImageFilter for grown output: 0.02691964569621114
The labels: (0, 1). Label count of statistics filter: 2
Mean from LabelStatisticsImageFilter for seeds: 0.9999993205070495
Covariance from LabelStatisticsImageFilter for seeds: 7.25345709421769e-14
Number of iteration: 2
Mean from VectorConfidenceConnectedImageFilter: (0.038716337214620644, 55.72496796726461, 36.093515782149844)
Covariance matrix from VectorConfidenceConnectedImageFilter:
[[ 2.69196225e-02 -8.70168501e-01 -5.37384540e-01]
[ -8.70168501e-01 2.78522779e+02 1.66893233e+02]
[ -5.37384540e-01 1.66893233e+02 1.27068694e+02]]
Mean from LabelStatisticsImageFilter for grown output: 0.0
Covariance from LabelStatisticsImageFilter for grown output: 0.0
The labels: (0,). Label count of statistics filter: 1
Mean from LabelStatisticsImageFilter for seeds: 0.9999993205070495
Covariance from LabelStatisticsImageFilter for seeds: 7.25345709421769e-14
Number of iteration: 3
Mean from VectorConfidenceConnectedImageFilter: (nan, nan, nan)
Covariance matrix from VectorConfidenceConnectedImageFilter:
[[ nan nan nan]
[ nan nan nan]
[ nan nan nan]]
Mean from LabelStatisticsImageFilter for grown output: 0.0
Covariance from LabelStatisticsImageFilter for grown output: 0.0
The labels: (0,). Label count of statistics filter: 1
Mean from LabelStatisticsImageFilter for seeds: 0.9999993205070495
Covariance from LabelStatisticsImageFilter for seeds: 7.25345709421769e-14
Number of iteration: 4
Mean from VectorConfidenceConnectedImageFilter: (nan, nan, nan)
Covariance matrix from VectorConfidenceConnectedImageFilter:
[[ nan nan nan]
[ nan nan nan]
[ nan nan nan]]
Mean from LabelStatisticsImageFilter for grown output: 0.0
Covariance from LabelStatisticsImageFilter for grown output: 0.0
The labels: (0,). Label count of statistics filter: 1
Mean from LabelStatisticsImageFilter for seeds: 0.9999993205070495
Covariance from LabelStatisticsImageFilter for seeds: 7.25345709421769e-14
至于initialNeighborhoodRadius,我没有手动设置它。根据文件中的文字,
“邻域的平均值和方差(8-connected, 针对种子点计算26连接等。 “
。默认情况下,它不是26连接的邻居?
此外,官方文件中还有一些名为“来自种子点的初始细分”。如何在算法中管理多个种子?它是否像使用多个种子初始化的先进先出队列?对于置信度连通图像滤波器,可以看出通过使用种子点的邻居的均值和标准差来定义初始生长标准。当我使用多个种子时,这个初始标准是否仅从第一个种子或所有种子无偏见地生成?
答案 0 :(得分:2)
可能有几个问题。
1)你说输出什么都没有。预期输出是0和1的图像。如果直接显示该图像,则许多视图将仅显示黑色图像。一个简单的可视化可以是255乘以,或者你可以使用LabelToRGBImageFilter。另外,您可以运行LabelStatisticsImageFilter。
2)这似乎不是您输入和使用的正确过滤器。此过滤器的文档说:
此滤镜提取像素强度的连接像素集 与种子点的像素统计一致。均值 和邻居的差异(8连接,26连接等) 计算种子点。然后像素连接到此种子 其值在种子的置信区间内的点 点被分组。
这意味着如果你只给它> 0.999的像素,那么估计的均值和方差将非常紧张,并且该区域不会增长太多。您可以再次使用LabelStatisticsImageFilter来计算标签图像下强度的统计信息。
使用ConnectedThresholdImageFilter手动设置下限阈值可能更合适。您还可以查看DoubleThresholdImageFilter,它执行这两个步骤(按阈值选择种子,然后将区域增加到阈值)。