Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rotate angle to radians #57

Merged
merged 1 commit into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions 2d_classification/mednist_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,32 @@
"## Setup environment"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%pip install -q \"monai[pillow, tqdm]\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# FIXME: install MONAI from source code, will remove it when v0.4.0 released\n",
"pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup environment"
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand Down Expand Up @@ -99,7 +125,7 @@
"import numpy as np\n",
"import PIL\n",
"import torch\n",
"\n",
"import numpy as np\n",
"from monai.apps import download_and_extract\n",
"from monai.config import print_config\n",
"from monai.metrics import compute_roc_auc\n",
Expand Down Expand Up @@ -358,7 +384,7 @@
" LoadPNG(image_only=True),\n",
" AddChannel(),\n",
" ScaleIntensity(),\n",
" RandRotate(range_x=15, prob=0.5, keep_size=True),\n",
" RandRotate(range_x=np.pi / 12, prob=0.5, keep_size=True),\n",
" RandFlip(spatial_axis=0, prob=0.5),\n",
" RandZoom(min_zoom=0.9, max_zoom=1.1, prob=0.5),\n",
" ToTensor(),\n",
Expand Down Expand Up @@ -757,7 +783,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
"version": "3.6.10"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion acceleration/automatic_mixed_precision.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
}
],
"source": [
"%pip install -q \"monai[gdown, nibabel, tqdm]\""
"%pip install -q \"monai[nibabel, tqdm]\""
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion acceleration/dataset_type_performance.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"outputs": [],
"source": [
"%pip install -q \"monai[gdown, nibabel, tqdm]\""
"%pip install -q \"monai[nibabel, tqdm]\""
]
},
{
Expand Down
14 changes: 12 additions & 2 deletions acceleration/transform_speed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
"%pip install -q \"monai[nibabel]\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# FIXME: install MONAI from source code, will remove it when v0.4.0 released\n",
"pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -273,7 +283,7 @@
" LoadNifti(image_only=True),\n",
" ScaleIntensity(),\n",
" AddChannel(),\n",
" Rotate(angle=45.0),\n",
" Rotate(angle=np.pi / 4),\n",
" RandSpatialCrop((64, 64, 64), random_size=False),\n",
" ToTensor(),\n",
" ]\n",
Expand All @@ -283,7 +293,7 @@
" [\n",
" LoadNifti(image_only=True),\n",
" AddChannel(),\n",
" Rotate(angle=45.0),\n",
" Rotate(angle=np.pi / 4),\n",
" RandSpatialCrop((64, 64, 64), random_size=False),\n",
" ToTensor(),\n",
" ]\n",
Expand Down
2 changes: 1 addition & 1 deletion modules/3d_image_transforms.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}
],
"source": [
"%pip install -q \"monai[gdown, nibabel]\""
"%pip install -q \"monai[nibabel]\""
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions modules/autoencoder_mednist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
" LoadPNGD(keys=[\"im\"]),\n",
" AddChannelD(keys=[\"im\"]),\n",
" ScaleIntensityD(keys=[\"im\"]),\n",
" RandRotateD(keys=[\"im\"], range_x=15, prob=0.5, keep_size=True),\n",
" RandRotateD(keys=[\"im\"], range_x=np.pi / 12, prob=0.5, keep_size=True),\n",
" RandFlipD(keys=[\"im\"], spatial_axis=0, prob=0.5),\n",
" RandZoomD(keys=[\"im\"], min_zoom=0.9, max_zoom=1.1, prob=0.5),\n",
" ToTensorD(keys=[\"im\"]),\n",
Expand Down Expand Up @@ -521,7 +521,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
"version": "3.6.10"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions modules/engines/gan_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import sys

import torch

import numpy as np
import monai
from monai.apps.utils import download_and_extract
from monai.data import CacheDataset, DataLoader, png_writer
Expand Down Expand Up @@ -69,7 +69,7 @@ def main():
LoadPNGD(keys=["hand"]),
AddChannelD(keys=["hand"]),
ScaleIntensityD(keys=["hand"]),
RandRotateD(keys=["hand"], range_x=15, prob=0.5, keep_size=True),
RandRotateD(keys=["hand"], range_x=np.pi / 12, prob=0.5, keep_size=True),
RandFlipD(keys=["hand"], spatial_axis=0, prob=0.5),
RandZoomD(keys=["hand"], min_zoom=0.9, max_zoom=1.1, prob=0.5),
ToTensorD(keys=["hand"]),
Expand Down
2 changes: 1 addition & 1 deletion modules/integrate_3rd_party_transforms.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}
],
"source": [
"%pip install -q \"monai[gdown]\""
"%pip install -q \"monai[nibabel]\""
]
},
{
Expand Down
14 changes: 12 additions & 2 deletions modules/mednist_GAN_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
"%pip install -q monai"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# FIXME: install MONAI from source code, will remove it when v0.4.0 released\n",
"pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI"
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand Down Expand Up @@ -117,7 +127,7 @@
"\n",
"import matplotlib.pyplot as plt\n",
"import torch\n",
"\n",
"import numpy as np\n",
"from monai.config import print_config\n",
"from monai.data import CacheDataset\n",
"from monai.networks import normal_init\n",
Expand Down Expand Up @@ -242,7 +252,7 @@
" LoadTarJpeg(),\n",
" AddChannel(),\n",
" ScaleIntensity(),\n",
" RandRotate(range_x=15, prob=0.5, keep_size=True),\n",
" RandRotate(range_x=np.pi / 12, prob=0.5, keep_size=True),\n",
" RandFlip(spatial_axis=0, prob=0.5),\n",
" RandZoom(min_zoom=0.9, max_zoom=1.1, prob=0.5),\n",
" ToTensor(),\n",
Expand Down
14 changes: 12 additions & 2 deletions modules/mednist_GAN_workflow_array.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@
"%pip install -q \"monai[ignite, tqdm]\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# FIXME: install MONAI from source code, will remove it when v0.4.0 released\n",
"pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI"
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down Expand Up @@ -127,7 +137,7 @@
"\n",
"import matplotlib.pyplot as plt\n",
"import torch\n",
"\n",
"import numpy as np\n",
"import monai\n",
"print(monai.__file__)\n",
"\n",
Expand Down Expand Up @@ -285,7 +295,7 @@
" LoadTarJpeg(),\n",
" AddChannel(),\n",
" ScaleIntensity(),\n",
" RandRotate(range_x=15, prob=0.5, keep_size=True),\n",
" RandRotate(range_x=np.pi / 12, prob=0.5, keep_size=True),\n",
" RandFlip(spatial_axis=0, prob=0.5),\n",
" RandZoom(min_zoom=0.9, max_zoom=1.1, prob=0.5),\n",
" ToTensor(),\n",
Expand Down
14 changes: 12 additions & 2 deletions modules/mednist_GAN_workflow_dict.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@
"%pip install -q \"monai[ignite, tqdm]\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# FIXME: install MONAI from source code, will remove it when v0.4.0 released\n",
"pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI"
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down Expand Up @@ -119,7 +129,7 @@
"\n",
"import matplotlib.pyplot as plt\n",
"import torch\n",
"\n",
"import numpy as np\n",
"from monai.apps import download_and_extract\n",
"from monai.config import print_config\n",
"from monai.data import CacheDataset, DataLoader\n",
Expand Down Expand Up @@ -281,7 +291,7 @@
" LoadPNGD(keys=[\"hand\"]),\n",
" AddChannelD(keys=[\"hand\"]),\n",
" ScaleIntensityD(keys=[\"hand\"]),\n",
" RandRotateD(keys=[\"hand\"], range_x=15, prob=0.5, keep_size=True),\n",
" RandRotateD(keys=[\"hand\"], range_x=np.pi / 12, prob=0.5, keep_size=True),\n",
" RandFlipD(keys=[\"hand\"], spatial_axis=0, prob=0.5),\n",
" RandZoomD(keys=[\"hand\"], min_zoom=0.9, max_zoom=1.1, prob=0.5),\n",
" ToTensorD(keys=[\"hand\"]),\n",
Expand Down