VBoussot commited on
Commit
4da2996
·
verified ·
1 Parent(s): 9248035

feat: add DentalSegmentator as the dental model

Browse files

DentalSegmentator's nnU-Net v2 model (Dataset111_453CT, fold 0) as the
'dental' app: maxilla, mandible, upper and lower teeth and mandibular
canal on dento-maxillo-facial CT and CBCT, converted weight-exact by
dental_build/build.py.

README.md CHANGED
@@ -9,30 +9,39 @@ tags:
9
  - ct
10
  - mri
11
  - cbct
 
12
  - konfai
13
  ---
14
 
15
- # ImpactSeg — Multimodal Body Segmentation
16
 
17
- Multimodal (**CBCT / MR / CT**) anatomical **body segmentation** (11 structures), built with
18
- [**KonfAI**](https://github.com/vboussot/KonfAI). One model handles all three modalities.
 
19
 
20
- ## 🧩 Model
21
 
22
  | Model | Input | Output | Labels | Ensemble |
23
  |:--|:--|:--|:--:|:--:|
24
  | `body` | Volume (CT / MR / CBCT) | Segmentation | 11 | 1 |
 
25
 
26
- 2.5D residual-encoder UNet · patch `[1, 192, 192]` · resampled to 3 mm.
 
 
 
 
27
 
28
  ## 🚀 Usage
29
 
30
  ```bash
31
  pip install impact_seg_konfai
32
  impact-seg-konfai segment body -i input.nii.gz -o output/
 
33
  ```
34
 
35
  - **Generic runner:** `konfai-apps infer VBoussot/ImpactSeg:body -i input.nii.gz -o output/`
 
36
  - **Interactive:** [**SlicerKonfAI**](https://github.com/vboussot/SlicerKonfAI) — the ⚙ *Advanced* dialog overrides patch size and batch size.
37
 
38
  ## ⚡ Performance & VRAM
@@ -47,8 +56,28 @@ Benchmarked on a single **NVIDIA RTX PRO 5000 (24 GB)** with a real whole-body C
47
 
48
  Single-model body segmentation keeps **system RAM ~1.6 GB**. The thin 2-D patches never fill the card, so inference stays compute-bound (~7 s, largely batch-independent). Override with `--patch-size` / `--batch-size`.
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  ## 🔗 Links
51
 
52
  - 🧠 **KonfAI:** [github.com/vboussot/KonfAI](https://github.com/vboussot/KonfAI)
53
  - 📦 **PyPI:** [impact_seg_konfai](https://pypi.org/project/impact_seg_konfai/)
54
  - 📄 **Paper:** [arXiv:2510.21358](https://arxiv.org/abs/2510.21358)
 
 
9
  - ct
10
  - mri
11
  - cbct
12
+ - dental
13
  - konfai
14
  ---
15
 
16
+ # ImpactSeg — Segmentation
17
 
18
+ Segmentation models built with [**KonfAI**](https://github.com/vboussot/KonfAI): multimodal (**CBCT / MR / CT**)
19
+ anatomical **body segmentation** (11 structures, one model for all three modalities), and dento-maxillo-facial
20
+ segmentation with **DentalSegmentator**.
21
 
22
+ ## 🧩 Models
23
 
24
  | Model | Input | Output | Labels | Ensemble |
25
  |:--|:--|:--|:--:|:--:|
26
  | `body` | Volume (CT / MR / CBCT) | Segmentation | 11 | 1 |
27
+ | `dental` | Volume (CT / CBCT) | Segmentation | 5 | 1 |
28
 
29
+ - `body`: 2.5D residual-encoder UNet · patch `[1, 192, 192]` · resampled to 3 mm.
30
+ - `dental`: KonfAI adaptation of [**DentalSegmentator**](https://github.com/gaudot/SlicerDentalSegmentator) ·
31
+ labels 1 Maxilla & Upper Skull · 2 Mandible · 3 Upper Teeth · 4 Lower Teeth · 5 Mandibular canal · nnU-Net v2
32
+ `3d_fullres` PlainConvUNet (Dataset111_453CT, fold 0), converted weight-exact by `dental_build/build.py` ·
33
+ patch `[160, 128, 112]` · resampled to 0.45 × 0.45 × 0.31 mm.
34
 
35
  ## 🚀 Usage
36
 
37
  ```bash
38
  pip install impact_seg_konfai
39
  impact-seg-konfai segment body -i input.nii.gz -o output/
40
+ impact-seg-konfai segment dental -i input_cbct.nii.gz -o output/
41
  ```
42
 
43
  - **Generic runner:** `konfai-apps infer VBoussot/ImpactSeg:body -i input.nii.gz -o output/`
44
+ - **TTA / uncertainty (`dental`):** up to 7 random mirror copies (`--tta 7`; the model was trained with mirroring on all axes), `-uncertainty` for the per-voxel label variance.
45
  - **Interactive:** [**SlicerKonfAI**](https://github.com/vboussot/SlicerKonfAI) — the ⚙ *Advanced* dialog overrides patch size and batch size.
46
 
47
  ## ⚡ Performance & VRAM
 
56
 
57
  Single-model body segmentation keeps **system RAM ~1.6 GB**. The thin 2-D patches never fill the card, so inference stays compute-bound (~7 s, largely batch-independent). Override with `--patch-size` / `--batch-size`.
58
 
59
+ **`dental`** — Slicer's `PostDentalSurgery` CBCT (360 × 360 × 330, 0.5 mm), same weights, same PyTorch build (2.12.1,
60
+ cu13.0), same GPU, nnU-Net 2.x without TTA (2026-09-30):
61
+
62
+ | Tool | Time | Peak RAM |
63
+ |---|---|---|
64
+ | **KonfAI** | **15.9 s** | **2.3 GB** |
65
+ | Original (nnU-Net) | 60.7 s | 6.4 GB |
66
+
67
+ Dice against the original's output: 0.976 / 0.985 / 0.984 / 0.982 / 0.950 (labels 1–5), the same spread as the
68
+ original with vs. without its mirroring TTA (0.988 / 0.985 / 0.988 / 0.982 / 0.934).
69
+
70
+ ## 📚 Citation
71
+
72
+ `dental`:
73
+
74
+ > Dot G, et al. DentalSegmentator: robust open source deep learning-based CT and CBCT image segmentation. Journal of Dentistry (2024) doi:[10.1016/j.jdent.2024.105130](https://doi.org/10.1016/j.jdent.2024.105130)
75
+
76
+ > Isensee F, et al. nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation. Nat Methods. 2021;18(2):203-211. doi:[10.1038/s41592-020-01008-z](https://doi.org/10.1038/s41592-020-01008-z)
77
+
78
  ## 🔗 Links
79
 
80
  - 🧠 **KonfAI:** [github.com/vboussot/KonfAI](https://github.com/vboussot/KonfAI)
81
  - 📦 **PyPI:** [impact_seg_konfai](https://pypi.org/project/impact_seg_konfai/)
82
  - 📄 **Paper:** [arXiv:2510.21358](https://arxiv.org/abs/2510.21358)
83
+ - 🧠 **Original DentalSegmentator:** [github.com/gaudot/SlicerDentalSegmentator](https://github.com/gaudot/SlicerDentalSegmentator) (Apache-2.0) — the `dental` icon is its official logo.
dental/Evaluation.yml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Evaluator:
2
+ metrics:
3
+ Output:
4
+ targets_criterions:
5
+ Reference;Mask:
6
+ criterions_loader:
7
+ DiceSaveMap:
8
+ labels: None
9
+ dataset: ./Evaluations/DentalSegmentator/Output:mha
10
+ group: Seg_MAE_map
11
+ Dataset:
12
+ groups_src:
13
+ Mask_0:
14
+ groups_dest:
15
+ Mask:
16
+ transforms: None
17
+ Volume_0:
18
+ groups_dest:
19
+ Output:
20
+ transforms: None
21
+ Reference_0:
22
+ groups_dest:
23
+ Reference:
24
+ transforms: None
25
+ subset: None
26
+ dataset_filenames:
27
+ - ./Dataset:a:mha
28
+ validation: None
29
+ train_name: DentalSegmentator
dental/PlainConvUNet.yml ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Declarative KonfAI model reproducing DentalSegmentator's nnU-Net v2 PlainConvUNet
2
+ # (Dataset111_453CT, 3d_fullres): 6 stages, channels [32,64,128,256,320,320],
3
+ # Conv-InstanceNorm(affine)-LeakyReLU(0.01) x2 per stage, 6 output classes.
4
+ # Same node names as MRSegmentator's Unet_TS_MR.yml, so build.py maps the nnU-Net
5
+ # keys with the same Destination_Unet_1.txt.
6
+ #
7
+ # nnU-Net runs this network on arrays transposed by transpose_forward [1,0,2]; KonfAI
8
+ # feeds SimpleITK array order (Z,Y,X). build.py swaps the first two spatial axes of
9
+ # every kernel so the network runs in (Z,Y,X) directly. The deepest stride (2,2,1)
10
+ # is symmetric in that swap, so it reads the same in both orders.
11
+ name: DentalSegmentator
12
+
13
+ parameters:
14
+ dim: 3
15
+ num_classes: 6
16
+ channels: [1, 32, 64, 128, 256, 320, 320]
17
+
18
+ # Isotropic downsampling encoder block: first conv stride 2, second conv stride 1.
19
+ down_block_configs:
20
+ - $object: BlockConfig
21
+ args:
22
+ kernel_size: 3
23
+ stride: 2
24
+ padding: 1
25
+ bias: true
26
+ activation: LeakyReLU
27
+ norm_mode: INSTANCE_AFFINE
28
+ - $object: BlockConfig
29
+ args:
30
+ kernel_size: 3
31
+ stride: 1
32
+ padding: 1
33
+ bias: true
34
+ activation: LeakyReLU
35
+ norm_mode: INSTANCE_AFFINE
36
+
37
+ # Deepest-level downsampling block: anisotropic first-conv stride (2,2,1), second stride 1.
38
+ deep_down_block_configs:
39
+ - $object: BlockConfig
40
+ args:
41
+ kernel_size: 3
42
+ stride: [2, 2, 1]
43
+ padding: 1
44
+ bias: true
45
+ activation: LeakyReLU
46
+ norm_mode: INSTANCE_AFFINE
47
+ - $object: BlockConfig
48
+ args:
49
+ kernel_size: 3
50
+ stride: 1
51
+ padding: 1
52
+ bias: true
53
+ activation: LeakyReLU
54
+ norm_mode: INSTANCE_AFFINE
55
+
56
+ # Same-resolution block (top-level DownConvBlock and all UpConvBlocks): both stride 1.
57
+ stage_block_configs:
58
+ - $object: BlockConfig
59
+ args:
60
+ kernel_size: 3
61
+ stride: 1
62
+ padding: 1
63
+ bias: true
64
+ activation: LeakyReLU
65
+ norm_mode: INSTANCE_AFFINE
66
+ - $object: BlockConfig
67
+ args:
68
+ kernel_size: 3
69
+ stride: 1
70
+ padding: 1
71
+ bias: true
72
+ activation: LeakyReLU
73
+ norm_mode: INSTANCE_AFFINE
74
+
75
+ network:
76
+ in_channels: ${channels.0}
77
+ dim: ${dim}
78
+
79
+ modules:
80
+ # ---- UNetBlock level 0 (i=0): DownConv stride 1, no CONV_TRANSPOSE/SkipConnection ----
81
+ - name: UNetBlock
82
+ modules:
83
+ - name: DownConvBlock
84
+ type: ConvBlock
85
+ args:
86
+ in_channels: ${channels.0}
87
+ out_channels: ${channels.1}
88
+ block_configs: ${stage_block_configs}
89
+ dim: ${dim}
90
+
91
+ # ---- UNetBlock level 1 (i=1) ----
92
+ - name: UNetBlock
93
+ modules:
94
+ - name: DownConvBlock
95
+ type: ConvBlock
96
+ args:
97
+ in_channels: ${channels.1}
98
+ out_channels: ${channels.2}
99
+ block_configs: ${down_block_configs}
100
+ dim: ${dim}
101
+
102
+ # ---- UNetBlock level 2 (i=2) ----
103
+ - name: UNetBlock
104
+ modules:
105
+ - name: DownConvBlock
106
+ type: ConvBlock
107
+ args:
108
+ in_channels: ${channels.2}
109
+ out_channels: ${channels.3}
110
+ block_configs: ${down_block_configs}
111
+ dim: ${dim}
112
+
113
+ # ---- UNetBlock level 3 (i=3) ----
114
+ - name: UNetBlock
115
+ modules:
116
+ - name: DownConvBlock
117
+ type: ConvBlock
118
+ args:
119
+ in_channels: ${channels.3}
120
+ out_channels: ${channels.4}
121
+ block_configs: ${down_block_configs}
122
+ dim: ${dim}
123
+
124
+ # ---- UNetBlock level 4 (i=4) ----
125
+ - name: UNetBlock
126
+ modules:
127
+ - name: DownConvBlock
128
+ type: ConvBlock
129
+ args:
130
+ in_channels: ${channels.4}
131
+ out_channels: ${channels.5}
132
+ block_configs: ${down_block_configs}
133
+ dim: ${dim}
134
+
135
+ # ---- UNetBlock level 5 (i=5>4): deepest, ANISOTROPIC [2,2,1], no nested/UpConv ----
136
+ - name: UNetBlock
137
+ modules:
138
+ - name: DownConvBlock
139
+ type: ConvBlock
140
+ args:
141
+ in_channels: ${channels.5}
142
+ out_channels: ${channels.6}
143
+ block_configs: ${deep_down_block_configs}
144
+ dim: ${dim}
145
+ - name: CONV_TRANSPOSE
146
+ type: ConvTranspose
147
+ args:
148
+ dim: ${dim}
149
+ in_channels: ${channels.6}
150
+ out_channels: ${channels.5}
151
+ kernel_size: [2, 2, 1]
152
+ stride: [2, 2, 1]
153
+ - name: SkipConnection
154
+ type: Concat
155
+ in_branch: [0, 1]
156
+
157
+ - name: UpConvBlock
158
+ type: ConvBlock
159
+ args:
160
+ in_channels:
161
+ $multiply: ["${channels.5}", 2]
162
+ out_channels: ${channels.5}
163
+ block_configs: ${stage_block_configs}
164
+ dim: ${dim}
165
+ - name: CONV_TRANSPOSE
166
+ type: ConvTranspose
167
+ args:
168
+ dim: ${dim}
169
+ in_channels: ${channels.5}
170
+ out_channels: ${channels.4}
171
+ kernel_size: 2
172
+ stride: 2
173
+ - name: SkipConnection
174
+ type: Concat
175
+ in_branch: [0, 1]
176
+
177
+ - name: UpConvBlock
178
+ type: ConvBlock
179
+ args:
180
+ in_channels:
181
+ $multiply: ["${channels.4}", 2]
182
+ out_channels: ${channels.4}
183
+ block_configs: ${stage_block_configs}
184
+ dim: ${dim}
185
+ - name: CONV_TRANSPOSE
186
+ type: ConvTranspose
187
+ args:
188
+ dim: ${dim}
189
+ in_channels: ${channels.4}
190
+ out_channels: ${channels.3}
191
+ kernel_size: 2
192
+ stride: 2
193
+ - name: SkipConnection
194
+ type: Concat
195
+ in_branch: [0, 1]
196
+
197
+ - name: UpConvBlock
198
+ type: ConvBlock
199
+ args:
200
+ in_channels:
201
+ $multiply: ["${channels.3}", 2]
202
+ out_channels: ${channels.3}
203
+ block_configs: ${stage_block_configs}
204
+ dim: ${dim}
205
+ - name: CONV_TRANSPOSE
206
+ type: ConvTranspose
207
+ args:
208
+ dim: ${dim}
209
+ in_channels: ${channels.3}
210
+ out_channels: ${channels.2}
211
+ kernel_size: 2
212
+ stride: 2
213
+ - name: SkipConnection
214
+ type: Concat
215
+ in_branch: [0, 1]
216
+
217
+ - name: UpConvBlock
218
+ type: ConvBlock
219
+ args:
220
+ in_channels:
221
+ $multiply: ["${channels.2}", 2]
222
+ out_channels: ${channels.2}
223
+ block_configs: ${stage_block_configs}
224
+ dim: ${dim}
225
+ - name: CONV_TRANSPOSE
226
+ type: ConvTranspose
227
+ args:
228
+ dim: ${dim}
229
+ in_channels: ${channels.2}
230
+ out_channels: ${channels.1}
231
+ kernel_size: 2
232
+ stride: 2
233
+ - name: SkipConnection
234
+ type: Concat
235
+ in_branch: [0, 1]
236
+
237
+ - name: UpConvBlock
238
+ type: ConvBlock
239
+ args:
240
+ in_channels:
241
+ $multiply: ["${channels.1}", 2]
242
+ out_channels: ${channels.1}
243
+ block_configs: ${stage_block_configs}
244
+ dim: ${dim}
245
+
246
+ # ---- Head: Conv 1x1 (raw logits, no Softmax -- matches nnU-Net seg_layers) ----
247
+ - name: Head
248
+ modules:
249
+ - name: Conv
250
+ type: Conv
251
+ args:
252
+ dim: ${dim}
253
+ in_channels: ${channels.1}
254
+ out_channels: ${num_classes}
255
+ kernel_size: 1
dental/Prediction.yml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Predictor:
2
+ Model:
3
+ classpath: PlainConvUNet.yml
4
+ DentalSegmentator:
5
+ outputs_criterions: None
6
+ Dataset:
7
+ groups_src:
8
+ Volume_0:
9
+ groups_dest:
10
+ Volume:
11
+ transforms:
12
+ TensorCast:
13
+ dtype: float32
14
+ inverse: false
15
+ Clip:
16
+ min_value: -110.0
17
+ max_value: 3067.0
18
+ save_clip_min: false
19
+ save_clip_max: false
20
+ mask: None
21
+ Standardize:
22
+ lazy: false
23
+ mean:
24
+ - 1273.709228515625
25
+ std:
26
+ - 558.4849853515625
27
+ mask: None
28
+ inverse: false
29
+ Resample:
30
+ spacing:
31
+ - 0.4492189884185791
32
+ - 0.4492189884185791
33
+ - 0.31200000643730164
34
+ interpolation: cubic
35
+ inverse: true
36
+ patch_transforms: None
37
+ is_input: true
38
+ augmentations:
39
+ DataAugmentation_0:
40
+ data_augmentations:
41
+ Flip:
42
+ f_prob:
43
+ - 0.5
44
+ - 0.5
45
+ - 0.5
46
+ prob: 1
47
+ nb: 7
48
+ Patch:
49
+ patch_size:
50
+ - 160
51
+ - 128
52
+ - 112
53
+ overlap: 0.5
54
+ pad_value: 0
55
+ extend_slice: 0
56
+ subset: None
57
+ dataset_filenames:
58
+ - ./Dataset/:mha
59
+ batch_size: 0
60
+ outputs_dataset:
61
+ Head:Conv:
62
+ OutputDataset:
63
+ name_class: OutputDataset
64
+ before_reduction_transforms: None
65
+ after_reduction_transforms:
66
+ InferenceStack:
67
+ dataset: Predictions/DentalSegmentator/Output:mha
68
+ name: InferenceStack
69
+ mode: Seg
70
+ final_transforms:
71
+ Softmax:
72
+ dim: 0
73
+ Argmax:
74
+ dim: 0
75
+ TensorCast:
76
+ dtype: uint8
77
+ inverse: true
78
+ dataset_filename: Output:mha
79
+ group: Output
80
+ same_as_group: Volume_0:Volume
81
+ patch_combine: Gaussian
82
+ reduction: Concat
83
+ Concat: {}
84
+ train_name: DentalSegmentator
85
+ manual_seed: 32
86
+ gpu_checkpoints: None
87
+ combine: Concat
88
+ autocast: true
89
+ data_log: None
dental/Uncertainty.yml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Evaluator:
2
+ metrics:
3
+ Uncertainty:
4
+ targets_criterions:
5
+ None:
6
+ criterions_loader:
7
+ Mean:
8
+ name: Uncertainty
9
+ Dataset:
10
+ groups_src:
11
+ Volume_0:
12
+ groups_dest:
13
+ Uncertainty:
14
+ transforms:
15
+ Variance: {}
16
+ Save:
17
+ dataset: ./Uncertainties/DentalSegmentator/Output:mha
18
+ group: None
19
+ subset: None
20
+ dataset_filenames:
21
+ - ./Dataset:mha
22
+ validation: None
23
+ train_name: DentalSegmentator
dental/app.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "display_name": "Segmentation: DentalSegmentator",
3
+ "short_description": "<b>Description:</b><br>KonfAI adaptation of <a href='https://github.com/gaudot/SlicerDentalSegmentator'>DentalSegmentator</a>, segmenting the <b>maxilla, mandible, upper and lower teeth and mandibular canal</b> in dento-maxillo-facial <b>CT</b> and <b>CBCT</b> scans.<br><br><b>How to cite:</b><br><cite>G. Dot et al., <i>DentalSegmentator: robust open source deep learning-based CT and CBCT image segmentation</i>, Journal of Dentistry, 2024.</cite>",
4
+ "description": "<b>Description:</b><br>Adaptation of the original <a href='https://github.com/gaudot/SlicerDentalSegmentator'>DentalSegmentator</a> nnU-Net model into the <b>KonfAI</b> framework.<br><br><b>Capabilities:</b><br>• Segmentation of <b>5 classes</b>: maxilla & upper skull, mandible, upper teeth, lower teeth, mandibular canal<br>• Works on <b>CT</b> and <b>CBCT</b>, independently of the field of view<br><br><b>Training data:</b><br>Trained on 470 dento-maxillo-facial CT and CBCT scans, evaluated on a hold-out set of 256 scans from 7 institutions<br><br><b>How to cite:</b><br><cite>G. Dot et al., <i>DentalSegmentator: robust open source deep learning-based CT and CBCT image segmentation</i>, Journal of Dentistry, 2024.</cite>",
5
+ "tta": 7,
6
+ "mc_dropout": 0,
7
+ "models": [
8
+ "fold_0.pt"
9
+ ],
10
+ "inputs": {
11
+ "Volume": {
12
+ "display_name": "Input Volume",
13
+ "volume_type": "VOLUME",
14
+ "required": true
15
+ }
16
+ },
17
+ "outputs": {
18
+ "Segmentation": {
19
+ "display_name": "Segmentation",
20
+ "volume_type": "SEGMENTATION",
21
+ "required": true
22
+ }
23
+ },
24
+ "inputs_evaluations": {
25
+ "Image": {
26
+ "Evaluation.yml": {
27
+ "Segmentation": {
28
+ "display_name": "Output Segmentation",
29
+ "volume_type": "VOLUME",
30
+ "required": true
31
+ },
32
+ "GT_Segmentation": {
33
+ "display_name": "GT Segmentation",
34
+ "volume_type": "VOLUME",
35
+ "required": true
36
+ }
37
+ }
38
+ }
39
+ },
40
+ "terminology": {
41
+ "1": {
42
+ "name": "Maxilla & Upper Skull",
43
+ "color": "#E3DD90"
44
+ },
45
+ "2": {
46
+ "name": "Mandible",
47
+ "color": "#D4A1E6"
48
+ },
49
+ "3": {
50
+ "name": "Upper Teeth",
51
+ "color": "#DC9565"
52
+ },
53
+ "4": {
54
+ "name": "Lower Teeth",
55
+ "color": "#EBDFB4"
56
+ },
57
+ "5": {
58
+ "name": "Mandibular canal",
59
+ "color": "#D8654F"
60
+ }
61
+ },
62
+ "task": "segmentation"
63
+ }
dental/fold_0.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:002cf645c51fb1bdfd5a49db424d584f4ee70295bb2119e72ddb4ada8cd47904
3
+ size 123165901
dental/icon.png ADDED
dental_build/Destination_Unet_1.txt ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ UNetBlock.DownConvBlock.Conv_0.weight
2
+ UNetBlock.DownConvBlock.Conv_0.bias
3
+ UNetBlock.DownConvBlock.Norm_0.weight
4
+ UNetBlock.DownConvBlock.Norm_0.bias
5
+ UNetBlock.DownConvBlock.Conv_1.weight
6
+ UNetBlock.DownConvBlock.Conv_1.bias
7
+ UNetBlock.DownConvBlock.Norm_1.weight
8
+ UNetBlock.DownConvBlock.Norm_1.bias
9
+ UNetBlock.UNetBlock.DownConvBlock.Conv_0.weight
10
+ UNetBlock.UNetBlock.DownConvBlock.Conv_0.bias
11
+ UNetBlock.UNetBlock.DownConvBlock.Norm_0.weight
12
+ UNetBlock.UNetBlock.DownConvBlock.Norm_0.bias
13
+ UNetBlock.UNetBlock.DownConvBlock.Conv_1.weight
14
+ UNetBlock.UNetBlock.DownConvBlock.Conv_1.bias
15
+ UNetBlock.UNetBlock.DownConvBlock.Norm_1.weight
16
+ UNetBlock.UNetBlock.DownConvBlock.Norm_1.bias
17
+ UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_0.weight
18
+ UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_0.bias
19
+ UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_0.weight
20
+ UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_0.bias
21
+ UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_1.weight
22
+ UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_1.bias
23
+ UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_1.weight
24
+ UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_1.bias
25
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_0.weight
26
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_0.bias
27
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_0.weight
28
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_0.bias
29
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_1.weight
30
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_1.bias
31
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_1.weight
32
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_1.bias
33
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_0.weight
34
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_0.bias
35
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_0.weight
36
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_0.bias
37
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_1.weight
38
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_1.bias
39
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_1.weight
40
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_1.bias
41
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_0.weight
42
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_0.bias
43
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_0.weight
44
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_0.bias
45
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_1.weight
46
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Conv_1.bias
47
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_1.weight
48
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.DownConvBlock.Norm_1.bias
49
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Conv_0.weight
50
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Conv_0.bias
51
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Norm_0.weight
52
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Norm_0.bias
53
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Conv_1.weight
54
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Conv_1.bias
55
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Norm_1.weight
56
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Norm_1.bias
57
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Conv_0.weight
58
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Conv_0.bias
59
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Norm_0.weight
60
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Norm_0.bias
61
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Conv_1.weight
62
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Conv_1.bias
63
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Norm_1.weight
64
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Norm_1.bias
65
+ UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Conv_0.weight
66
+ UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Conv_0.bias
67
+ UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Norm_0.weight
68
+ UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Norm_0.bias
69
+ UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Conv_1.weight
70
+ UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Conv_1.bias
71
+ UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Norm_1.weight
72
+ UNetBlock.UNetBlock.UNetBlock.UpConvBlock.Norm_1.bias
73
+ UNetBlock.UNetBlock.UpConvBlock.Conv_0.weight
74
+ UNetBlock.UNetBlock.UpConvBlock.Conv_0.bias
75
+ UNetBlock.UNetBlock.UpConvBlock.Norm_0.weight
76
+ UNetBlock.UNetBlock.UpConvBlock.Norm_0.bias
77
+ UNetBlock.UNetBlock.UpConvBlock.Conv_1.weight
78
+ UNetBlock.UNetBlock.UpConvBlock.Conv_1.bias
79
+ UNetBlock.UNetBlock.UpConvBlock.Norm_1.weight
80
+ UNetBlock.UNetBlock.UpConvBlock.Norm_1.bias
81
+ UNetBlock.UpConvBlock.Conv_0.weight
82
+ UNetBlock.UpConvBlock.Conv_0.bias
83
+ UNetBlock.UpConvBlock.Norm_0.weight
84
+ UNetBlock.UpConvBlock.Norm_0.bias
85
+ UNetBlock.UpConvBlock.Conv_1.weight
86
+ UNetBlock.UpConvBlock.Conv_1.bias
87
+ UNetBlock.UpConvBlock.Norm_1.weight
88
+ UNetBlock.UpConvBlock.Norm_1.bias
89
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.CONV_TRANSPOSE.weight
90
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.CONV_TRANSPOSE.bias
91
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.CONV_TRANSPOSE.weight
92
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.UNetBlock.CONV_TRANSPOSE.bias
93
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.CONV_TRANSPOSE.weight
94
+ UNetBlock.UNetBlock.UNetBlock.UNetBlock.CONV_TRANSPOSE.bias
95
+ UNetBlock.UNetBlock.UNetBlock.CONV_TRANSPOSE.weight
96
+ UNetBlock.UNetBlock.UNetBlock.CONV_TRANSPOSE.bias
97
+ UNetBlock.UNetBlock.CONV_TRANSPOSE.weight
98
+ UNetBlock.UNetBlock.CONV_TRANSPOSE.bias
99
+ Head.Conv.weight
100
+ Head.Conv.bias
dental_build/build.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Convert DentalSegmentator's nnU-Net v2 checkpoint into dental/fold_0.pt.
2
+
3
+ The nnU-Net keys are mapped in order onto Destination_Unet_1.txt (the node names of
4
+ PlainConvUNet.yml), skipping the deep-supervision heads. nnU-Net runs the network on arrays
5
+ transposed by transpose_forward [1,0,2]; KonfAI feeds SimpleITK (Z,Y,X), so the first two spatial
6
+ axes of every kernel are swapped.
7
+ """
8
+
9
+ import io
10
+ import zipfile
11
+
12
+ import requests
13
+ import torch
14
+
15
+ URL = "https://github.com/gaudot/SlicerDentalSegmentator/releases/download/v1.0.0-alpha/Dataset111_453CT_v100.zip"
16
+
17
+ with zipfile.ZipFile(io.BytesIO(requests.get(URL).content)) as zip_f:
18
+ checkpoint = next(name for name in zip_f.namelist() if name.endswith("fold_0/checkpoint_final.pth"))
19
+ state_dict = torch.load(zip_f.open(checkpoint), map_location="cpu", weights_only=False)["network_weights"]
20
+
21
+ keys = [
22
+ key
23
+ for key in state_dict
24
+ if "all_modules" not in key
25
+ and "decoder.encoder" not in key
26
+ and ("seg_layers" not in key or "seg_layers.4" in key)
27
+ ]
28
+ destinations = open("dental_build/Destination_Unet_1.txt").read().split()
29
+ assert len(keys) == len(destinations)
30
+
31
+ weights = {}
32
+ for key, destination in zip(keys, destinations):
33
+ tensor = state_dict[key]
34
+ weights[destination] = tensor.transpose(2, 3).contiguous() if tensor.dim() == 5 else tensor
35
+
36
+ torch.save({"Model": {"DentalSegmentator": weights}}, "dental/fold_0.pt")