Skip to content

Commit 211cfd8

Browse files
Remove deprecated feature for v1.5 (#1989)
Part of Project-MONAI/MONAI#8421 ### Description Remove deprecated feature for v1.5 ### Checks <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [ ] Avoid including large-size files in the PR. - [ ] Clean up long text outputs from code cells in the notebook. - [ ] For security purposes, please check the contents and remove any sensitive info such as user names and private key. - [ ] Ensure (1) hyperlinks and markdown anchors are working (2) use relative paths for tutorial repo files (3) put figure and graphs in the `./figure` folder - [ ] Notebook runs automatically `./runner.sh -t <path to .ipynb file>` --------- Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent fd86def commit 211cfd8

35 files changed

+67
-66
lines changed

3d_segmentation/spleen_segmentation_3d.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@
284284
" b_max=1.0,\n",
285285
" clip=True,\n",
286286
" ),\n",
287-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
287+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
288288
" Orientationd(keys=[\"image\", \"label\"], axcodes=\"RAS\"),\n",
289289
" Spacingd(keys=[\"image\", \"label\"], pixdim=(1.5, 1.5, 2.0), mode=(\"bilinear\", \"nearest\")),\n",
290290
" RandCropByPosNegLabeld(\n",
@@ -318,7 +318,7 @@
318318
" b_max=1.0,\n",
319319
" clip=True,\n",
320320
" ),\n",
321-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
321+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
322322
" Orientationd(keys=[\"image\", \"label\"], axcodes=\"RAS\"),\n",
323323
" Spacingd(keys=[\"image\", \"label\"], pixdim=(1.5, 1.5, 2.0), mode=(\"bilinear\", \"nearest\")),\n",
324324
" ]\n",
@@ -690,7 +690,7 @@
690690
" b_max=1.0,\n",
691691
" clip=True,\n",
692692
" ),\n",
693-
" CropForegroundd(keys=[\"image\"], source_key=\"image\"),\n",
693+
" CropForegroundd(keys=[\"image\"], source_key=\"image\", allow_smaller=True),\n",
694694
" ]\n",
695695
")\n",
696696
"\n",
@@ -784,7 +784,7 @@
784784
" b_max=1.0,\n",
785785
" clip=True,\n",
786786
" ),\n",
787-
" CropForegroundd(keys=[\"image\"], source_key=\"image\"),\n",
787+
" CropForegroundd(keys=[\"image\"], source_key=\"image\", allow_smaller=True),\n",
788788
" ]\n",
789789
")\n",
790790
"\n",

3d_segmentation/spleen_segmentation_3d_lightning.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@
278278
" b_max=1.0,\n",
279279
" clip=True,\n",
280280
" ),\n",
281-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
281+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
282282
" # randomly crop out patch samples from\n",
283283
" # big image based on pos / neg ratio\n",
284284
" # the image centers of negative samples\n",
@@ -321,7 +321,7 @@
321321
" b_max=1.0,\n",
322322
" clip=True,\n",
323323
" ),\n",
324-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
324+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
325325
" ]\n",
326326
" )\n",
327327
"\n",

3d_segmentation/spleen_segmentation_3d_visualization_basic.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@
317317
" b_max=1.0,\n",
318318
" clip=True,\n",
319319
" ),\n",
320-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
320+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
321321
" Orientationd(keys=[\"image\", \"label\"], axcodes=\"RAS\"),\n",
322322
" Spacingd(keys=[\"image\", \"label\"], pixdim=(1.5, 1.5, 2.0), mode=(\"bilinear\", \"nearest\")),\n",
323323
" RandCropByPosNegLabeld(\n",
@@ -351,7 +351,7 @@
351351
" b_max=1.0,\n",
352352
" clip=True,\n",
353353
" ),\n",
354-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
354+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
355355
" Orientationd(keys=[\"image\", \"label\"], axcodes=\"RAS\"),\n",
356356
" Spacingd(keys=[\"image\", \"label\"], pixdim=(1.5, 1.5, 2.0), mode=(\"bilinear\", \"nearest\")),\n",
357357
" ]\n",
@@ -782,7 +782,7 @@
782782
" b_max=1.0,\n",
783783
" clip=True,\n",
784784
" ),\n",
785-
" CropForegroundd(keys=[\"image\"], source_key=\"image\"),\n",
785+
" CropForegroundd(keys=[\"image\"], source_key=\"image\", allow_smaller=True),\n",
786786
" ]\n",
787787
")\n",
788788
"\n",

3d_segmentation/swin_unetr_brats21_segmentation_3d.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@
326326
" keys=[\"image\", \"label\"],\n",
327327
" source_key=\"image\",\n",
328328
" k_divisible=[roi[0], roi[1], roi[2]],\n",
329+
" allow_smaller=True,\n",
329330
" ),\n",
330331
" transforms.RandSpatialCropd(\n",
331332
" keys=[\"image\", \"label\"],\n",
@@ -467,7 +468,6 @@
467468
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
468469
"\n",
469470
"model = SwinUNETR(\n",
470-
" img_size=roi,\n",
471471
" in_channels=4,\n",
472472
" out_channels=3,\n",
473473
" feature_size=48,\n",

3d_segmentation/swin_unetr_btcv_segmentation_3d.ipynb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
" b_max=1.0,\n",
244244
" clip=True,\n",
245245
" ),\n",
246-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
246+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
247247
" Orientationd(keys=[\"image\", \"label\"], axcodes=\"RAS\"),\n",
248248
" Spacingd(\n",
249249
" keys=[\"image\", \"label\"],\n",
@@ -292,7 +292,7 @@
292292
" [\n",
293293
" LoadImaged(keys=[\"image\", \"label\"], ensure_channel_first=True),\n",
294294
" ScaleIntensityRanged(keys=[\"image\"], a_min=-175, a_max=250, b_min=0.0, b_max=1.0, clip=True),\n",
295-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
295+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
296296
" Orientationd(keys=[\"image\", \"label\"], axcodes=\"RAS\"),\n",
297297
" Spacingd(\n",
298298
" keys=[\"image\", \"label\"],\n",
@@ -439,7 +439,6 @@
439439
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
440440
"\n",
441441
"model = SwinUNETR(\n",
442-
" img_size=(96, 96, 96),\n",
443442
" in_channels=1,\n",
444443
" out_channels=14,\n",
445444
" feature_size=48,\n",

3d_segmentation/unetr_btcv_segmentation_3d.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@
228228
" b_max=1.0,\n",
229229
" clip=True,\n",
230230
" ),\n",
231-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
231+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
232232
" RandCropByPosNegLabeld(\n",
233233
" keys=[\"image\", \"label\"],\n",
234234
" label_key=\"label\",\n",
@@ -277,7 +277,7 @@
277277
" mode=(\"bilinear\", \"nearest\"),\n",
278278
" ),\n",
279279
" ScaleIntensityRanged(keys=[\"image\"], a_min=-175, a_max=250, b_min=0.0, b_max=1.0, clip=True),\n",
280-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
280+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
281281
" ]\n",
282282
")"
283283
]

3d_segmentation/unetr_btcv_segmentation_3d_lightning.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@
466466
" b_max=1.0,\n",
467467
" clip=True,\n",
468468
" ),\n",
469-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
469+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
470470
" Orientationd(keys=[\"image\", \"label\"], axcodes=\"RAS\"),\n",
471471
" Spacingd(\n",
472472
" keys=[\"image\", \"label\"],\n",
@@ -522,7 +522,7 @@
522522
" b_max=1.0,\n",
523523
" clip=True,\n",
524524
" ),\n",
525-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
525+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
526526
" Orientationd(keys=[\"image\", \"label\"], axcodes=\"RAS\"),\n",
527527
" Spacingd(\n",
528528
" keys=[\"image\", \"label\"],\n",

acceleration/automatic_mixed_precision.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199
" b_max=1.0,\n",
200200
" clip=True,\n",
201201
" ),\n",
202-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
202+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
203203
" # pre-compute foreground and background indexes\n",
204204
" # and cache them to accelerate training\n",
205205
" FgBgToIndicesd(\n",
@@ -241,7 +241,7 @@
241241
" b_max=1.0,\n",
242242
" clip=True,\n",
243243
" ),\n",
244-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
244+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
245245
" ]\n",
246246
" )\n",
247247
" return train_transforms, val_transforms"

acceleration/dataset_type_performance.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@
380380
" b_max=1.0,\n",
381381
" clip=True,\n",
382382
" ),\n",
383-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
383+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
384384
" # randomly crop out patch samples from big\n",
385385
" # image based on pos / neg ratio\n",
386386
" # the image centers of negative samples\n",
@@ -420,7 +420,7 @@
420420
" b_max=1.0,\n",
421421
" clip=True,\n",
422422
" ),\n",
423-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
423+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
424424
" ]\n",
425425
" )\n",
426426
" return train_transforms, val_transforms"

acceleration/fast_training_tutorial.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
" clip=True,\n",
312312
" ),\n",
313313
" ),\n",
314-
" range_func(\"CropForeground\", CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\")),\n",
314+
" range_func(\"CropForeground\", CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True)),\n",
315315
" # pre-compute foreground and background indexes\n",
316316
" # and cache them to accelerate training\n",
317317
" range_func(\n",
@@ -368,7 +368,7 @@
368368
" b_max=1.0,\n",
369369
" clip=True,\n",
370370
" ),\n",
371-
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\"),\n",
371+
" CropForegroundd(keys=[\"image\", \"label\"], source_key=\"image\", allow_smaller=True),\n",
372372
" ]\n",
373373
" if fast:\n",
374374
" # convert the data to Tensor without meta, move to GPU and cache to avoid CPU -> GPU sync in every epoch\n",

0 commit comments

Comments
 (0)