VBoussot commited on
Commit
ae888a5
·
verified ·
1 Parent(s): 9b707f7

feat: no VRAM plan, every preset leaves its patch free and blends its tiles

Browse files

No app declares a `vram_plan` any more. Every preset leaves its patch free (`patch_size: [0, 0, 0]`): the volume runs as one patch when it fits, and the engine is handed exactly what it was without a patch. Otherwise konfai tiles it on the measured VRAM, the fewest equal patches that fit, overlapping by 20 % and blended with a `Cosinus` window: without a declared overlap and window the last patch written won, which left a seam in the displacement field where a patch starts. A registration forwards one pair: its batch stays 1.

CBCT_CT_HeadNeck/Prediction.yml CHANGED
@@ -138,8 +138,8 @@ Predictor:
138
  prob: 1
139
  nb: 2
140
  Patch:
141
- patch_size: None
142
- overlap: None
143
  pad_value: None
144
  extend_slice: 0
145
  subset: None
@@ -163,7 +163,7 @@ Predictor:
163
  dataset_filename: Transform:itktransform
164
  group: Transform
165
  same_as_group: Volume_0:Fixed
166
- patch_combine: None
167
  reduction: Mean
168
  Mean: {}
169
  train_name: ImpactReg-CBCT-CT-HeadNeck
 
138
  prob: 1
139
  nb: 2
140
  Patch:
141
+ patch_size: [0, 0, 0]
142
+ overlap: 20%
143
  pad_value: None
144
  extend_slice: 0
145
  subset: None
 
163
  dataset_filename: Transform:itktransform
164
  group: Transform
165
  same_as_group: Volume_0:Fixed
166
+ patch_combine: Cosinus
167
  reduction: Mean
168
  Mean: {}
169
  train_name: ImpactReg-CBCT-CT-HeadNeck
CBCT_CT_MRSeg/Prediction.yml CHANGED
@@ -171,8 +171,8 @@ Predictor:
171
  prob: 1
172
  nb: 2
173
  Patch:
174
- patch_size: None
175
- overlap: None
176
  pad_value: None
177
  extend_slice: 0
178
  subset: None
@@ -196,7 +196,7 @@ Predictor:
196
  dataset_filename: Transform:itktransform
197
  group: Transform
198
  same_as_group: Volume_0:Fixed
199
- patch_combine: None
200
  reduction: Mean
201
  Mean: {}
202
  train_name: ImpactReg-CBCT-CT-MRSeg
 
171
  prob: 1
172
  nb: 2
173
  Patch:
174
+ patch_size: [0, 0, 0]
175
+ overlap: 20%
176
  pad_value: None
177
  extend_slice: 0
178
  subset: None
 
196
  dataset_filename: Transform:itktransform
197
  group: Transform
198
  same_as_group: Volume_0:Fixed
199
+ patch_combine: Cosinus
200
  reduction: Mean
201
  Mean: {}
202
  train_name: ImpactReg-CBCT-CT-MRSeg
ConvexAdam_Coarse/Prediction.yml CHANGED
@@ -78,8 +78,8 @@ Predictor:
78
  prob: 1
79
  nb: 2
80
  Patch:
81
- patch_size: None
82
- overlap: None
83
  pad_value: None
84
  extend_slice: 0
85
  subset: None
@@ -103,7 +103,7 @@ Predictor:
103
  dataset_filename: Transform:itktransform
104
  group: Transform
105
  same_as_group: Volume_0:Fixed
106
- patch_combine: None
107
  reduction: Mean
108
  Mean: {}
109
  train_name: ImpactReg-ConvexAdam-Coarse
 
78
  prob: 1
79
  nb: 2
80
  Patch:
81
+ patch_size: [0, 0, 0]
82
+ overlap: 20%
83
  pad_value: None
84
  extend_slice: 0
85
  subset: None
 
103
  dataset_filename: Transform:itktransform
104
  group: Transform
105
  same_as_group: Volume_0:Fixed
106
+ patch_combine: Cosinus
107
  reduction: Mean
108
  Mean: {}
109
  train_name: ImpactReg-ConvexAdam-Coarse
ConvexAdam_Composite/Prediction.yml CHANGED
@@ -79,8 +79,8 @@ Predictor:
79
  prob: 1
80
  nb: 2
81
  Patch:
82
- patch_size: None
83
- overlap: None
84
  pad_value: None
85
  extend_slice: 0
86
  subset: None
@@ -104,7 +104,7 @@ Predictor:
104
  dataset_filename: Transform:itktransform
105
  group: Transform
106
  same_as_group: Volume_0:Fixed
107
- patch_combine: None
108
  reduction: Mean
109
  Mean: {}
110
  train_name: ImpactReg-ConvexAdam-Composite
 
79
  prob: 1
80
  nb: 2
81
  Patch:
82
+ patch_size: [0, 0, 0]
83
+ overlap: 20%
84
  pad_value: None
85
  extend_slice: 0
86
  subset: None
 
104
  dataset_filename: Transform:itktransform
105
  group: Transform
106
  same_as_group: Volume_0:Fixed
107
+ patch_combine: Cosinus
108
  reduction: Mean
109
  Mean: {}
110
  train_name: ImpactReg-ConvexAdam-Composite
ConvexAdam_Fine/Prediction.yml CHANGED
@@ -78,8 +78,8 @@ Predictor:
78
  prob: 1
79
  nb: 2
80
  Patch:
81
- patch_size: None
82
- overlap: None
83
  pad_value: None
84
  extend_slice: 0
85
  subset: None
@@ -103,7 +103,7 @@ Predictor:
103
  dataset_filename: Transform:itktransform
104
  group: Transform
105
  same_as_group: Volume_0:Fixed
106
- patch_combine: None
107
  reduction: Mean
108
  Mean: {}
109
  train_name: ImpactReg-ConvexAdam-Fine
 
78
  prob: 1
79
  nb: 2
80
  Patch:
81
+ patch_size: [0, 0, 0]
82
+ overlap: 20%
83
  pad_value: None
84
  extend_slice: 0
85
  subset: None
 
103
  dataset_filename: Transform:itktransform
104
  group: Transform
105
  same_as_group: Volume_0:Fixed
106
+ patch_combine: Cosinus
107
  reduction: Mean
108
  Mean: {}
109
  train_name: ImpactReg-ConvexAdam-Fine
ConvexAdam_Fine/app.json CHANGED
@@ -1,44 +1,10 @@
1
  {
2
  "display_name": "ConvexAdam Fine (MIND)",
3
  "short_description": "Fine Adam refinement (tileable; expects a coarse/pre-aligned start).",
4
- "description": "Second stage of the ConvexAdam pipeline: the Adam instance-optimisation refinement driven by the IMPACT metric on MIND features, with no linear pre-align (it assumes the moving is already on the fixed grid, e.g. resampled by the coarse stage). Runs from a zero warm-start and tiles naturally for large images (set a patch size).",
5
  "task": "registration",
6
  "tta": 0,
7
  "mc_dropout": 0,
8
- "vram_plan": {
9
- "8": {
10
- "patch_size": [
11
- 128,
12
- 128,
13
- 128
14
- ],
15
- "batch_size": 1
16
- },
17
- "16": {
18
- "patch_size": [
19
- 192,
20
- 192,
21
- 192
22
- ],
23
- "batch_size": 1
24
- },
25
- "24": {
26
- "patch_size": [
27
- 256,
28
- 256,
29
- 256
30
- ],
31
- "batch_size": 1
32
- },
33
- "40": {
34
- "patch_size": [
35
- 320,
36
- 320,
37
- 320
38
- ],
39
- "batch_size": 1
40
- }
41
- },
42
  "models": [],
43
  "inputs": {
44
  "Fixed": {
 
1
  {
2
  "display_name": "ConvexAdam Fine (MIND)",
3
  "short_description": "Fine Adam refinement (tileable; expects a coarse/pre-aligned start).",
4
+ "description": "Second stage of the ConvexAdam pipeline: the Adam instance-optimisation refinement driven by the IMPACT metric on MIND features, with no linear pre-align (it assumes the moving is already on the fixed grid, e.g. resampled by the coarse stage). Runs from a zero warm-start. A volume that fits the GPU runs as one patch; one that does not is tiled on its own, the tiles overlapping by 20 % and blended (a patch size can still be forced).",
5
  "task": "registration",
6
  "tta": 0,
7
  "mc_dropout": 0,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  "models": [],
9
  "inputs": {
10
  "Fixed": {
FireANTs_Affine/Prediction.yml CHANGED
@@ -75,8 +75,8 @@ Predictor:
75
  prob: 1
76
  nb: 2
77
  Patch:
78
- patch_size: None
79
- overlap: None
80
  pad_value: None
81
  extend_slice: 0
82
  subset: None
@@ -100,7 +100,7 @@ Predictor:
100
  dataset_filename: Transform:itktransform
101
  group: Transform
102
  same_as_group: Volume_0:Fixed
103
- patch_combine: None
104
  reduction: Mean
105
  Mean: {}
106
  train_name: ImpactReg-FireANTs-Affine
 
75
  prob: 1
76
  nb: 2
77
  Patch:
78
+ patch_size: [0, 0, 0]
79
+ overlap: 20%
80
  pad_value: None
81
  extend_slice: 0
82
  subset: None
 
100
  dataset_filename: Transform:itktransform
101
  group: Transform
102
  same_as_group: Volume_0:Fixed
103
+ patch_combine: Cosinus
104
  reduction: Mean
105
  Mean: {}
106
  train_name: ImpactReg-FireANTs-Affine
FireANTs_IMPACT/Prediction.yml CHANGED
@@ -82,8 +82,8 @@ Predictor:
82
  prob: 1
83
  nb: 2
84
  Patch:
85
- patch_size: None
86
- overlap: None
87
  pad_value: None
88
  extend_slice: 0
89
  subset: None
@@ -107,7 +107,7 @@ Predictor:
107
  dataset_filename: Transform:itktransform
108
  group: Transform
109
  same_as_group: Volume_0:Fixed
110
- patch_combine: None
111
  reduction: Mean
112
  Mean: {}
113
  train_name: ImpactReg-FireANTs-IMPACT
 
82
  prob: 1
83
  nb: 2
84
  Patch:
85
+ patch_size: [0, 0, 0]
86
+ overlap: 20%
87
  pad_value: None
88
  extend_slice: 0
89
  subset: None
 
107
  dataset_filename: Transform:itktransform
108
  group: Transform
109
  same_as_group: Volume_0:Fixed
110
+ patch_combine: Cosinus
111
  reduction: Mean
112
  Mean: {}
113
  train_name: ImpactReg-FireANTs-IMPACT
FireANTs_SyN/Prediction.yml CHANGED
@@ -75,8 +75,8 @@ Predictor:
75
  prob: 1
76
  nb: 2
77
  Patch:
78
- patch_size: None
79
- overlap: None
80
  pad_value: None
81
  extend_slice: 0
82
  subset: None
@@ -100,7 +100,7 @@ Predictor:
100
  dataset_filename: Transform:itktransform
101
  group: Transform
102
  same_as_group: Volume_0:Fixed
103
- patch_combine: None
104
  reduction: Mean
105
  Mean: {}
106
  train_name: ImpactReg-FireANTs-SyN
 
75
  prob: 1
76
  nb: 2
77
  Patch:
78
+ patch_size: [0, 0, 0]
79
+ overlap: 20%
80
  pad_value: None
81
  extend_slice: 0
82
  subset: None
 
100
  dataset_filename: Transform:itktransform
101
  group: Transform
102
  same_as_group: Volume_0:Fixed
103
+ patch_combine: Cosinus
104
  reduction: Mean
105
  Mean: {}
106
  train_name: ImpactReg-FireANTs-SyN
Generic_Rigid/Prediction.yml CHANGED
@@ -59,8 +59,8 @@ Predictor:
59
  prob: 1
60
  nb: 2
61
  Patch:
62
- patch_size: None
63
- overlap: None
64
  pad_value: None
65
  extend_slice: 0
66
  subset: None
@@ -84,7 +84,7 @@ Predictor:
84
  dataset_filename: Transform:itktransform
85
  group: Transform
86
  same_as_group: Volume_0:Fixed
87
- patch_combine: None
88
  reduction: Mean
89
  Mean: {}
90
  train_name: ImpactReg-Generic-Rigid
 
59
  prob: 1
60
  nb: 2
61
  Patch:
62
+ patch_size: [0, 0, 0]
63
+ overlap: 20%
64
  pad_value: None
65
  extend_slice: 0
66
  subset: None
 
84
  dataset_filename: Transform:itktransform
85
  group: Transform
86
  same_as_group: Volume_0:Fixed
87
+ patch_combine: Cosinus
88
  reduction: Mean
89
  Mean: {}
90
  train_name: ImpactReg-Generic-Rigid
Generic_Rigid_BSpline/Prediction.yml CHANGED
@@ -61,8 +61,8 @@ Predictor:
61
  prob: 1
62
  nb: 2
63
  Patch:
64
- patch_size: None
65
- overlap: None
66
  pad_value: None
67
  extend_slice: 0
68
  subset: None
@@ -86,7 +86,7 @@ Predictor:
86
  dataset_filename: Transform:itktransform
87
  group: Transform
88
  same_as_group: Volume_0:Fixed
89
- patch_combine: None
90
  reduction: Mean
91
  Mean: {}
92
  train_name: ImpactReg-Generic-Rigid-BSpline
 
61
  prob: 1
62
  nb: 2
63
  Patch:
64
+ patch_size: [0, 0, 0]
65
+ overlap: 20%
66
  pad_value: None
67
  extend_slice: 0
68
  subset: None
 
86
  dataset_filename: Transform:itktransform
87
  group: Transform
88
  same_as_group: Volume_0:Fixed
89
+ patch_combine: Cosinus
90
  reduction: Mean
91
  Mean: {}
92
  train_name: ImpactReg-Generic-Rigid-BSpline
MR_CT_HeadNeck/Prediction.yml CHANGED
@@ -123,8 +123,8 @@ Predictor:
123
  prob: 1
124
  nb: 2
125
  Patch:
126
- patch_size: None
127
- overlap: None
128
  pad_value: None
129
  extend_slice: 0
130
  subset: None
@@ -148,7 +148,7 @@ Predictor:
148
  dataset_filename: Transform:itktransform
149
  group: Transform
150
  same_as_group: Volume_0:Fixed
151
- patch_combine: None
152
  reduction: Mean
153
  Mean: {}
154
  train_name: ImpactReg-MR-CT-HeadNeck
 
123
  prob: 1
124
  nb: 2
125
  Patch:
126
+ patch_size: [0, 0, 0]
127
+ overlap: 20%
128
  pad_value: None
129
  extend_slice: 0
130
  subset: None
 
148
  dataset_filename: Transform:itktransform
149
  group: Transform
150
  same_as_group: Volume_0:Fixed
151
+ patch_combine: Cosinus
152
  reduction: Mean
153
  Mean: {}
154
  train_name: ImpactReg-MR-CT-HeadNeck
MR_CT_MRSeg/Prediction.yml CHANGED
@@ -171,8 +171,8 @@ Predictor:
171
  prob: 1
172
  nb: 2
173
  Patch:
174
- patch_size: None
175
- overlap: None
176
  pad_value: None
177
  extend_slice: 0
178
  subset: None
@@ -196,7 +196,7 @@ Predictor:
196
  dataset_filename: Transform:itktransform
197
  group: Transform
198
  same_as_group: Volume_0:Fixed
199
- patch_combine: None
200
  reduction: Mean
201
  Mean: {}
202
  train_name: ImpactReg-MR-CT-MRSeg
 
171
  prob: 1
172
  nb: 2
173
  Patch:
174
+ patch_size: [0, 0, 0]
175
+ overlap: 20%
176
  pad_value: None
177
  extend_slice: 0
178
  subset: None
 
196
  dataset_filename: Transform:itktransform
197
  group: Transform
198
  same_as_group: Volume_0:Fixed
199
+ patch_combine: Cosinus
200
  reduction: Mean
201
  Mean: {}
202
  train_name: ImpactReg-MR-CT-MRSeg
MR_CT_TS/Prediction.yml CHANGED
@@ -171,8 +171,8 @@ Predictor:
171
  prob: 1
172
  nb: 2
173
  Patch:
174
- patch_size: None
175
- overlap: None
176
  pad_value: None
177
  extend_slice: 0
178
  subset: None
@@ -196,7 +196,7 @@ Predictor:
196
  dataset_filename: Transform:itktransform
197
  group: Transform
198
  same_as_group: Volume_0:Fixed
199
- patch_combine: None
200
  reduction: Mean
201
  Mean: {}
202
  train_name: ImpactReg-MR-CT-TS
 
171
  prob: 1
172
  nb: 2
173
  Patch:
174
+ patch_size: [0, 0, 0]
175
+ overlap: 20%
176
  pad_value: None
177
  extend_slice: 0
178
  subset: None
 
196
  dataset_filename: Transform:itktransform
197
  group: Transform
198
  same_as_group: Volume_0:Fixed
199
+ patch_combine: Cosinus
200
  reduction: Mean
201
  Mean: {}
202
  train_name: ImpactReg-MR-CT-TS
README.md CHANGED
@@ -75,6 +75,21 @@ Per-stage breakdown: linear pre-align **≈ 4.2 s** (ITK affine, MI) · coarse *
75
  One-time TorchScript feature-model load **≈ 7 s** (amortised across a batch). Times scale with case size;
76
  `--tta k` multiplies runtime. The `elastix + IMPACT` presets run through elastix and scale differently.
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  ## 🔗 Links & Citation
79
 
80
  - 🧠 **KonfAI:** [github.com/vboussot/KonfAI](https://github.com/vboussot/KonfAI)
 
75
  One-time TorchScript feature-model load **≈ 7 s** (amortised across a batch). Times scale with case size;
76
  `--tta k` multiplies runtime. The `elastix + IMPACT` presets run through elastix and scale differently.
77
 
78
+ ## 🧩 Large volumes
79
+
80
+ Every preset leaves its patch free (`patch_size: [0, 0, 0]`). A pair that fits the GPU runs as one patch, and
81
+ the engine receives exactly what it did before. When the GPU runs out of memory, KonfAI cuts the volume into
82
+ the fewest equal patches that fit, registers each, and blends the fields over a 20 % overlap with a cosine
83
+ window. A patch size can still be forced with `--patch-size`.
84
+
85
+ The `elastix + IMPACT` presets rarely get there. IMPACT computes its features on the whole image and, when that
86
+ does not fit the GPU, retries on smaller feature patches by itself: the run is slower, and the registration
87
+ stays one global registration.
88
+
89
+ Tiling suits a local, deformable stage (`ConvexAdam_Fine`, `FireANTs_SyN`). A global stage
90
+ (rigid, affine, the coarse ConvexAdam initialisation) is then estimated per patch, which is no longer one
91
+ global transform: for those, prefer a GPU the volume fits on, or a coarser input.
92
+
93
  ## 🔗 Links & Citation
94
 
95
  - 🧠 **KonfAI:** [github.com/vboussot/KonfAI](https://github.com/vboussot/KonfAI)