CTA数据集分割实验

数据预处理

直接读取文件夹随机按照8:2进行划分

1
2
3
4
part = 'Abdominal_Infrarenal'
part = 'Abdominal_Suprarenal'
part = 'Ascending_Arch'
part = 'Descending_Thoracic'

上述四个部位都是

1
Total: 78, Training: 62, Validation: 16

直接使用nii.gz文件,在最开始时,内存中直接先预处理和加载

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import yaml
from monai.transforms import (
AsDiscrete,
EnsureChannelFirstd,
Compose,
CropForegroundd,
LoadImaged,
Orientationd,
RandFlipd,
RandCropByPosNegLabeld,
RandShiftIntensityd,
ScaleIntensityRanged,
Spacingd,
RandRotate90d,
Rand3DElasticd,
ResizeWithPadOrCropd,
AdjustContrastd
)

config_path = "config/config.yaml"
with open(config_path, 'r', encoding='utf-8') as f:
config = yaml.safe_load(f)

# compose将transforms组合在一起
# 图像尺寸为[1, 259, 223, 74]
train_transforms = Compose(
[
# 加载图片的值和元数据,参数keys是data_dicts中设置的keys,表示对image还是label做变换
LoadImaged(keys=["image", "label", "all_lab"], image_only=False),
# 自动添加一个通道的维度,保证通道在第一维度
EnsureChannelFirstd(keys=["image", "label", "all_lab"]),
# 对图像进行一个方向变换,转为RAS坐标
Orientationd(keys=["image", "label", "all_lab"], axcodes="RAS"),
# 对图像进行重采样,体素间距重采样为[1.5, 1.5, 2.0]
Spacingd(
keys=["image", "label", "all_lab"],
pixdim=config['transforms']['spacing']['pixdim'],
mode=(config['transforms']['spacing']['mode']),
),
# 对图像值强度进行归一化,由a的范围归一到b,,不在a范围的值设置为0
ScaleIntensityRanged(
keys=["image"],
a_min=config['transforms']['scale_intensity']['a_min'],
a_max=config['transforms']['scale_intensity']['a_max'],
b_min=config['transforms']['scale_intensity']['b_min'],
b_max=config['transforms']['scale_intensity']['b_max'],
clip=config['transforms']['scale_intensity']['clip'],
),
# 根据key所指定的大于0的部分,对于图像的有效部分进行裁剪
CropForegroundd(keys=["image", "label", "all_lab"], source_key="label",
margin=config['transforms']['crop_foreground']['margin']),
ResizeWithPadOrCropd(keys=["image", "label", "all_lab"], spatial_size=config['transforms']['resize']['spatial_size'],
mode=config['transforms']['resize']['mode']),
# AdjustContrastd(keys=["image"], gamma = 2),
# 将图像裁剪为4个子图
RandCropByPosNegLabeld(
keys=["image", "label", "all_lab"],
label_key="label",
spatial_size=config['transforms']['rand_crop']['spatial_size'],
pos=config['transforms']['rand_crop']['pos'],
neg=config['transforms']['rand_crop']['neg'], # 设置为0,因为我们没有背景样本
num_samples=config['transforms']['rand_crop']['num_samples'],
image_key="image",
image_threshold=0,
),
# 随机旋转,按着0轴旋转,旋转概率为0.1
RandFlipd(
keys=["image", "label", "all_lab"],
spatial_axis=[0],
prob=0.5,
),
# 随机旋转,按着1轴旋转,旋转概率为0.1
RandFlipd(
keys=["image", "label", "all_lab"],
spatial_axis=[1],
prob=0.5,
),
# 随机旋转,按着2轴旋转,旋转概率为0.1
RandFlipd(
keys=["image", "label", "all_lab"],
spatial_axis=[2],
prob=0.5,
),
# 随机旋转,概率为0.1,旋转次数为3
RandRotate90d(
keys=["image", "label", "all_lab"],
prob=0.5,
max_k=4,
),
# 随机强度转换,强度偏移量为[-0.1, 0.1],概率为0.5
RandShiftIntensityd(
keys=["image"],
offsets=config['transforms']['rand_shift_intensity']['offsets'],
prob=config['transforms']['rand_shift_intensity']['prob'],
),
]
)

val_transforms = Compose(
[
# 加载图片的值和元数据,参数keys是data_dicts中设置的keys,表示对image还是label做变换
LoadImaged(keys=["image", "label", "all_lab"], image_only=False),
# 自动添加一个通道的维度,保证通道在第一维度
EnsureChannelFirstd(keys=["image", "label", "all_lab"]),
# 对图像进行一个方向变换,转为RAS坐标
Orientationd(keys=["image", "label", "all_lab"], axcodes="RAS"),
# 对图像进行重采样,体素间距重采样为[1.5, 1.5, 2.0]
Spacingd(
keys=["image", "label", "all_lab"],
pixdim=config['transforms']['spacing']['pixdim'],
mode=(config['transforms']['spacing']['mode']),
),
# 对图像值强度进行归一化,由a的范围归一到b,,不在a范围的值设置为0
ScaleIntensityRanged(
keys=["image"],
a_min=config['transforms']['scale_intensity']['a_min'],
a_max=config['transforms']['scale_intensity']['a_max'],
b_min=config['transforms']['scale_intensity']['b_min'],
b_max=config['transforms']['scale_intensity']['b_max'],
clip=config['transforms']['scale_intensity']['clip'],
),
# 根据key所指定的大于0的部分,对于图像的有效部分进行裁剪
CropForegroundd(keys=["image", "label", "all_lab"], source_key="label",
margin=config['transforms']['crop_foreground']['margin']),
ResizeWithPadOrCropd(keys=["image", "label", "all_lab"], spatial_size=config['transforms']['resize']['spatial_size'],
mode=config['transforms']['resize']['mode']),
]
)

增加DIS部位

DIS

1
Total: 56, Training: 44, Validation: 12

DIS_Abdominal_Infrarenal

1
Total: 29, Training: 23, Validation: 6

DIS_Abdominal_Suprarenal

1
Total: 30, Training: 24, Validation: 6

DIS_Ascending_Arch

1
Total: 36, Training: 28, Validation: 8

DIS_Descending_Thoracic

1
Total: 46, Training: 36, Validation: 10

实验

exp test_dsc test_iou
V2 0.725165 0.568831

使用basicunet

将img和all_lab在通道维度进行拼接

Abdominal_Infrarenal

exp test_dsc
exp_2 0.758985

Abdominal_Suprarenal

exp test_dsc
exp_3 0.823703

Ascending_Arch部位

exp test_dsc
exp_1 0.884087

Descending_Thoracic

exp test_dsc
exp_5 0.700073
exp_6 0.656711

DIS

exp test_dsc
exp_17 0.818056

DIS_Abdominal_Infrarenal

exp test_dsc
exp_18 0.701003

DIS_Abdominal_Suprarenal

exp test_dsc
exp_19 0.836815

DIS_Ascending_Arch

exp test_dsc
exp_20 0.821586

DIS_Descending_Thoracic

exp test_dsc
exp_21 0.672169

使用segmamba

Abdominal_Infrarenal

exp test_dsc
exp_8 0.768712

Abdominal_Suprarenal

exp test_dsc
exp_9 0.847736

Ascending_Arch部位

exp test_dsc
exp_10 0.899080

Descending_Thoracic

exp test_dsc
exp_7 0.755863

DIS

exp test_dsc
exp_22 0.819693

DIS_Abdominal_Infrarenal

exp test_dsc
exp_23 0.633685
exp_31 0.893325

DIS_Abdominal_Suprarenal

exp test_dsc
exp_24 0.884835

DIS_Ascending_Arch

exp test_dsc
exp_25 0.872596

DIS_Descending_Thoracic

exp test_dsc
exp_26 0.828840

使用echomamba

Abdominal_Infrarenal

exp test_dsc
exp_11 0.763986

Abdominal_Suprarenal

exp test_dsc
exp_12 0.797840
exp_16 0.797988

Ascending_Arch部位

exp test_dsc
exp_14 0.878406

Descending_Thoracic

exp test_dsc
exp_15 0.730438

DIS

exp test_dsc
exp_26 0.754187

DIS_Abdominal_Infrarenal

exp test_dsc
exp_27 0.843867

DIS_Abdominal_Suprarenal

exp test_dsc
exp_28 0.926013

DIS_Ascending_Arch

exp test_dsc
exp_29 0.799774
exp_32 0.929628

DIS_Descending_Thoracic

exp test_dsc
exp_30 0.809732

汇总

U-net EchoMamba SegMamba
Abdominal_Infrarenal 75.90 76.40 76.87
Abdominal_Suprarenal 82.37 79.80 84.77
Ascending_Arch 88.41 87.84 89.91
Descending_Thoracic 70.01 73.04 75.59
DIS 81.81 75.42 81.97
DIS_Abdominal_Infrarenal 70.10 84.39 89.33
DIS_Abdominal_Suprarenal 83.68 92.60 88.48
DIS_Ascending_Arch 87.26 92.96 87.26
DIS_Descending_Thoracic 67.22 80.97 82.88

CTA数据集分割实验
http://example.com/2025/09/11/CTA-seg/
作者
Mercury
发布于
2025年9月11日
许可协议