Skip to content

Commit b2dc1c9

Browse files
committed
Merge branch 'main' into update-modules
Signed-off-by: Wenqi Li <[email protected]>
2 parents 8153b68 + 6db5983 commit b2dc1c9

File tree

161 files changed

+12401
-1871
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+12401
-1871
lines changed

.github/workflows/pep8.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
# quick tests for every pull request
55
push:
66
branches:
7-
- master
7+
- main
88
pull_request:
99

1010
jobs:

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,16 @@ tests/testing_data/*Hippocampus*
138138
# Ignore torch saves
139139
*/torch/runs
140140
logs
141+
*/runs
142+
lightning_logs
143+
144+
# ignore automatically created files
145+
*.ts
146+
nohup.out
147+
deepgrow/ignite/_image.nii.gz
148+
*.zip
149+
deployment/bentoml/mednist_classifier_bentoml.py
150+
deployment/ray/mednist_classifier_start.py
151+
*.nii.gz
152+
3d_segmentation/out
153+
*.nsys-rep

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ci:
99

1010
repos:
1111
- repo: https://github.com/pre-commit/pre-commit-hooks
12-
rev: v4.1.0
12+
rev: v4.3.0
1313
hooks:
1414
- id: end-of-file-fixer
1515
- id: trailing-whitespace

2d_classification/mednist_tutorial.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"* Train the model with a PyTorch program\n",
1616
"* Evaluate on test dataset\n",
1717
"\n",
18-
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/master/2d_classification/mednist_tutorial.ipynb)"
18+
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/main/2d_classification/mednist_tutorial.ipynb)"
1919
]
2020
},
2121
{

2d_registration/registration_mednist.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"- a UNet-like registration network with an affine head to predict the affine transformation parameters;\n",
1414
"- a warp function, implemented as a MONAI C++/CUDA module, to transform the moving image.\n",
1515
"\n",
16-
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/master/2d_registration/registration_mednist.ipynb)"
16+
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/main/2d_registration/registration_mednist.ipynb)"
1717
]
1818
},
1919
{

3d_classification/densenet_training_array.ipynb

Lines changed: 60 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"\n",
1111
"Here, the task is given to classify MR images into male/female.\n",
1212
"\n",
13-
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/master/3d_classification/torch/densenet_training_array.ipynb)"
13+
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/main/3d_classification/torch/densenet_training_array.ipynb)"
1414
]
1515
},
1616
{
@@ -131,40 +131,17 @@
131131
}
132132
],
133133
"source": [
134-
"# set this in your environment or previous cell to wherever IXI is downloaded and extracted\n",
134+
"# Set data directory\n",
135135
"directory = os.environ.get(\"MONAI_DATA_DIRECTORY\")\n",
136-
"\n",
137-
"if directory is None:\n",
138-
" resource = \"http://biomedic.doc.ic.ac.uk/brain-development/downloads/IXI/IXI-T1.tar\"\n",
139-
" md5 = \"34901a0593b41dd19c1a1f746eac2d58\"\n",
140-
"\n",
141-
" root_dir = tempfile.mkdtemp()\n",
142-
"\n",
143-
" dataset_dir = os.path.join(root_dir, \"ixi\")\n",
144-
" tarfile_name = f\"{dataset_dir}.tar\"\n",
145-
"\n",
146-
" download_and_extract(resource, tarfile_name, dataset_dir, md5)\n",
147-
"else:\n",
148-
" root_dir = directory\n",
149-
"\n",
136+
"root_dir = tempfile.mkdtemp() if directory is None else directory\n",
150137
"print(root_dir)"
151138
]
152139
},
153140
{
154141
"cell_type": "code",
155142
"execution_count": 4,
156143
"metadata": {},
157-
"outputs": [
158-
{
159-
"name": "stdout",
160-
"output_type": "stream",
161-
"text": [
162-
"<class 'torch.Tensor'> torch.Size([3, 1, 96, 96, 96]) tensor([[1., 0.],\n",
163-
" [1., 0.],\n",
164-
" [1., 0.]]) torch.Size([3, 2])\n"
165-
]
166-
}
167-
],
144+
"outputs": [],
168145
"source": [
169146
"# IXI dataset as a demo, downloadable from https://brain-development.org/ixi-dataset/\n",
170147
"images = [\n",
@@ -195,8 +172,58 @@
195172
"\n",
196173
"# Represent labels in one-hot format for binary classifier training,\n",
197174
"# BCEWithLogitsLoss requires target to have same shape as input\n",
198-
"labels = torch.nn.functional.one_hot(torch.as_tensor(labels)).float()\n",
175+
"labels = torch.nn.functional.one_hot(torch.as_tensor(labels)).float()"
176+
]
177+
},
178+
{
179+
"cell_type": "code",
180+
"execution_count": 5,
181+
"metadata": {},
182+
"outputs": [
183+
{
184+
"name": "stderr",
185+
"output_type": "stream",
186+
"text": [
187+
"ixi.tar: 100%|██████████| 4.51G/4.51G [08:19<00:00, 9.70MB/s] \n"
188+
]
189+
},
190+
{
191+
"name": "stdout",
192+
"output_type": "stream",
193+
"text": [
194+
"2022-05-04 12:23:06,530 - INFO - Downloaded: /mnt/data/rbrown/Documents/Data/MONAI/ixi.tar\n",
195+
"2022-05-04 12:23:13,734 - INFO - Verified 'ixi.tar', md5: 34901a0593b41dd19c1a1f746eac2d58.\n",
196+
"2022-05-04 12:23:13,735 - INFO - Writing into directory: /mnt/data/rbrown/Documents/Data/MONAI/ixi.\n"
197+
]
198+
}
199+
],
200+
"source": [
201+
"if not os.path.isfile(images[0]):\n",
202+
" resource = \"http://biomedic.doc.ic.ac.uk/brain-development/downloads/IXI/IXI-T1.tar\"\n",
203+
" md5 = \"34901a0593b41dd19c1a1f746eac2d58\"\n",
199204
"\n",
205+
" dataset_dir = os.path.join(root_dir, \"ixi\")\n",
206+
" tarfile_name = f\"{dataset_dir}.tar\"\n",
207+
"\n",
208+
" download_and_extract(resource, tarfile_name, dataset_dir, md5)"
209+
]
210+
},
211+
{
212+
"cell_type": "code",
213+
"execution_count": 6,
214+
"metadata": {},
215+
"outputs": [
216+
{
217+
"name": "stdout",
218+
"output_type": "stream",
219+
"text": [
220+
"<class 'torch.Tensor'> torch.Size([3, 1, 96, 96, 96]) tensor([[1., 0.],\n",
221+
" [1., 0.],\n",
222+
" [1., 0.]]) torch.Size([3, 2])\n"
223+
]
224+
}
225+
],
226+
"source": [
200227
"# Define transforms\n",
201228
"train_transforms = Compose([ScaleIntensity(), AddChannel(), Resize((96, 96, 96)), RandRotate90(), EnsureType()])\n",
202229
"\n",
@@ -220,7 +247,7 @@
220247
},
221248
{
222249
"cell_type": "code",
223-
"execution_count": 5,
250+
"execution_count": 7,
224251
"metadata": {},
225252
"outputs": [
226253
{
@@ -367,7 +394,7 @@
367394
},
368395
{
369396
"cell_type": "code",
370-
"execution_count": 6,
397+
"execution_count": 8,
371398
"metadata": {},
372399
"outputs": [],
373400
"source": [
@@ -395,7 +422,7 @@
395422
},
396423
{
397424
"cell_type": "code",
398-
"execution_count": 7,
425+
"execution_count": 9,
399426
"metadata": {},
400427
"outputs": [],
401428
"source": [
@@ -405,7 +432,7 @@
405432
},
406433
{
407434
"cell_type": "code",
408-
"execution_count": 8,
435+
"execution_count": 10,
409436
"metadata": {
410437
"scrolled": true,
411438
"tags": []
@@ -462,7 +489,7 @@
462489
},
463490
{
464491
"cell_type": "code",
465-
"execution_count": 9,
492+
"execution_count": 11,
466493
"metadata": {},
467494
"outputs": [],
468495
"source": [

3d_registration/paired_lung_ct.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"1. Compute DiceLoss and BendingEnergyLoss\n",
1919
"1. Compute MeanDice metric\n",
2020
"\n",
21-
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/master/3d_registration/paired_lung_ct.ipynb)"
21+
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/main/3d_registration/paired_lung_ct.ipynb)"
2222
]
2323
},
2424
{

3d_segmentation/brats_segmentation_3d.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"1. the enhancing tumor structures (light blue) visible in T1Gd, surrounding the cystic/necrotic components of the core (green) (Fig. C).\n",
3636
"1. The segmentations are combined to generate the final labels of the tumor sub-regions (Fig.D): edema (yellow), non-enhancing solid core (red), necrotic/cystic core (green), enhancing core (blue).\n",
3737
"\n",
38-
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/master/3d_segmentation/brats_segmentation_3d.ipynb)"
38+
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/main/3d_segmentation/brats_segmentation_3d.ipynb)"
3939
]
4040
},
4141
{

3d_segmentation/challenge_baseline/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ This baseline method achieves 0.6904 ± 0.1801 Dice score on the challenge valid
109109

110110
- For MONAI technical documentation, please visit [docs.monai.io](https://docs.monai.io/).
111111
- Please visit [`Project-MONAI/tutorials`](https://github.com/Project-MONAI/tutorials) for more examples, including:
112-
- [`3D segmentation pipelines`](https://github.com/Project-MONAI/tutorials/tree/master/3d_segmentation),
113-
- [`Dynamic UNet`](https://github.com/Project-MONAI/tutorials/blob/master/modules/dynunet_tutorial.ipynb),
114-
- [`Training acceleration`](https://github.com/Project-MONAI/tutorials/tree/master/acceleration).
112+
- [`3D segmentation pipelines`](https://github.com/Project-MONAI/tutorials/tree/main/3d_segmentation),
113+
- [`Dynamic UNet`](https://github.com/Project-MONAI/tutorials/blob/main/modules/dynunet_tutorial.ipynb),
114+
- [`Training acceleration`](https://github.com/Project-MONAI/tutorials/tree/main/acceleration).
115115

116116
## Submitting to the leaderboard
117117

@@ -121,4 +121,4 @@ For any queries, please contact [the challenge organizers](https://covid-segment
121121

122122
## License
123123

124-
The code is licensed under [the Apache License 2.0](https://github.com/Project-MONAI/tutorials/blob/master/LICENSE).
124+
The code is licensed under [the Apache License 2.0](https://github.com/Project-MONAI/tutorials/blob/main/LICENSE).

3d_segmentation/spleen_segmentation_3d.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"Source: Memorial Sloan Kettering Cancer Center \n",
3030
"Challenge: Large ranging foreground size\n",
3131
"\n",
32-
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/master/3d_segmentation/spleen_segmentation_3d.ipynb)"
32+
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/main/3d_segmentation/spleen_segmentation_3d.ipynb)"
3333
]
3434
},
3535
{

3d_segmentation/spleen_segmentation_3d_lightning.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"Source: Memorial Sloan Kettering Cancer Center \n",
3535
"Challenge: Large ranging foreground size\n",
3636
"\n",
37-
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/master/3d_segmentation/spleen_segmentation_3d_lightning.ipynb)"
37+
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/main/3d_segmentation/spleen_segmentation_3d_lightning.ipynb)"
3838
]
3939
},
4040
{

3d_segmentation/spleen_segmentation_3d_visualization_basic.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"Source: Memorial Sloan Kettering Cancer Center \n",
3232
"Challenge: Large ranging foreground size\n",
3333
"\n",
34-
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/master/3d_segmentation/spleen_segmentation_3d.ipynb)"
34+
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/main/3d_segmentation/spleen_segmentation_3d.ipynb)"
3535
]
3636
},
3737
{

0 commit comments

Comments
 (0)