-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathamos22.yaml
More file actions
136 lines (118 loc) · 4.39 KB
/
Copy pathamos22.yaml
File metadata and controls
136 lines (118 loc) · 4.39 KB
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
130
131
132
133
134
135
136
# Target: Abdominal organ segmentation (Task 1 CT only)
# Modality: CT
# Size: 500 CT cases (240 Training, 100 Validation, 160 Testing)
# Source: Longgang District Central Hospital and Longgang District People's Hospital, SZ, China
# Challenge: Segmentation of 15 organs from diverse clinical scenarios
num_channels: 1
num_classes: 16 # 15 organs + background
patch_size: [176, 176, 64] # Need to reduce this for softl1ace to prevent CUDA OOM
val_windows_size: [192, 192, 64]
resample_resolution: [1.0, 1.0, 5.0]
class_names: $['background', 'spleen', 'right_kidney', 'left_kidney', 'gallbladder', 'esophagus', 'liver', 'stomach', 'aorta', 'inferior_vena_cava', 'pancreas', 'right_adrenal_gland', 'left_adrenal_gland', 'duodenum', 'bladder', 'prostate/uterus']
batch_name_transform: $src.utils.meta_data_batch_transform
image_name_transform: $src.utils.meta_data_image_transform
learning_rate: 0.0002
##########################
# DATASET SETUP
##########################
dataset_dir: '../data/amos22'
# Filter out MRI data by checking if the id number is less than 500
train_cases: '$sorted([case for case in glob.glob(os.path.join(@dataset_dir, "imagesTr", "amos_*.nii.gz")) if int(os.path.basename(case).split("_")[1].split(".")[0]) < 500])'
train_labels: '$[os.path.join(@dataset_dir, "labelsTr", os.path.basename(case)) for case in @train_cases]'
data_dicts: "$[{'image': img, 'label': lbl} for img, lbl in zip(@train_cases, @train_labels)]"
partitions: '$monai.data.partition_dataset(@data_dicts, (9, 1), shuffle=True, seed=@seed)'
train_sub: '$@partitions[0]'
val_sub: '$@partitions[1]'
# Define the test dataset from imagesVa and labelsVa, and filter out MRI data
test_cases: '$sorted([case for case in glob.glob(os.path.join(@dataset_dir, "imagesVa", "amos_*.nii.gz")) if int(os.path.basename(case).split("_")[1].split(".")[0]) < 500])'
test_labels: '$[os.path.join(@dataset_dir, "labelsVa", os.path.basename(case)) for case in @test_cases]'
test_sub: "$[{'image': img, 'label': lbl} for img, lbl in zip(@test_cases, @test_labels)]"
##########################
# PRE-PROCESSING TRANSFORMATIONS
##########################
load_transforms:
- _target_: LoadImaged
keys: ['image', 'label']
- _target_: EnsureChannelFirstd
keys: ['image', 'label']
- _target_: EnsureTyped
keys: ['image', 'label']
- _target_: EnsureSameShaped
keys: ['label']
source_key: 'image'
allow_missing_keys: true
warn: '@debug'
resample_transforms:
- _target_: CropForegroundd
keys: ['image', 'label']
source_key: 'image'
- _target_: Orientationd
keys: ['image', 'label']
axcodes: 'RAS'
- _target_: Spacingd
keys: ['image', 'label']
pixdim: '@resample_resolution'
mode: ['bilinear', 'nearest']
normalize_transforms:
- _target_: ScaleIntensityRanged
keys: ['image']
a_min: -100
a_max: 200
b_min: 0.0
b_max: 1.0
clip: true
augmentation_transforms:
- _target_: RandAffined
keys: ['image', 'label']
prob: 0.5
rotate_range: [0.1, 0.1, 0.1]
shear_range: [0.1, 0.1, 0.1]
translate_range: [0.1, 0.1, 0.1]
scale_range: [0.1, 0.1, 0.1]
mode: ['bilinear', 'nearest']
padding_mode: ['constant', 'border']
# - _target_: Rand3DElasticd
# keys: ['image', 'label']
# sigma_range: [1, 2]
# magnitude_range: [0, 0.2]
# prob: 0.5
# rotate_range: [0.1, 0.1, 0.1]
# shear_range: [0.1, 0.1, 0.1]
# translate_range: [0.1, 0.1, 0.1]
# scale_range: [0.1, 0.1, 0.1]
# mode: ['bilinear', 'nearest']
crop_transforms:
- _target_: FgBgToIndicesd
keys: 'label'
fg_postfix: '_fg'
bg_postfix: '_bg'
image_key: 'image'
- _target_: RandCropByPosNegLabeld
keys: ['image', 'label']
label_key: 'label'
spatial_size: '@patch_size'
pos: 1
neg: 1
num_samples: 4
fg_indices_key: 'label_fg'
bg_indices_key: 'label_bg'
image_key: 'image'
image_threshold: 0
train_transforms:
- _target_: Compose
transforms: $@load_transforms + @resample_transforms + @normalize_transforms + @augmentation_transforms + @crop_transforms
val_transforms:
_target_: Compose
transforms: $@load_transforms + @resample_transforms + @normalize_transforms
##########################
# POST-PROCESSING AND INFERENCE
##########################
val_postprocessing:
_target_: Compose
transforms:
- _target_: Activationsd
keys: '@pred'
softmax: true
- _target_: AsDiscreted
keys: '@label'
to_onehot: '@num_classes'