Skip to content

Commit 104c4e7

Browse files
MMelQinSimoneBendazzoli93
authored andcommitted
Editorial changes to correct typos, rename parameters, and add comments (Project-MONAI#526)
* Editorial changes to correct typos, rename parameters, adding comments. Retested examples. Signed-off-by: M Q <[email protected]> * More editorial changes covering the whole repo Signed-off-by: M Q <[email protected]> * Fix flake8 complaint Signed-off-by: M Q <[email protected]> * Fix flake8 complaints Signed-off-by: M Q <[email protected]> --------- Signed-off-by: M Q <[email protected]> Signed-off-by: Simone Bendazzoli <[email protected]>
1 parent 76d8dc3 commit 104c4e7

File tree

8 files changed

+50
-54
lines changed

8 files changed

+50
-54
lines changed

docs/source/developing_with_sdk/packaging_app.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ It is required that the application configuration yaml file as well as the depen
1313
### Basic Usage of MONAI Application Packager
1414

1515
```bash
16-
monai-deploy package <APP_PATH> --config <CONFIG> --tag <TAG> --platform <x86_64> [--models <MODEL_PATH>] [--log-level <LEVEL>] [-h]
16+
monai-deploy package <APP_PATH> --config <CONFIG> --tag <TAG> --platform <x64-workstation> [--models <MODEL_PATH>] [--log-level <LEVEL>] [-h]
1717
```
1818

1919
#### Required Arguments
2020

2121
* `<APP_PATH>`: A path to MONAI Deploy Application folder or main code.
2222
* `--config, -c <CONFIG>`: Path to the application configuration file.
2323
* `--tag, -t <TAG>`: A MAP name and optionally a tag in the 'name:tag' format.
24-
* `--platform <PLATFORM>`: Platform type of the container image, must be `x86_64` for x86-64 system.
24+
* `--platform <PLATFORM>`: Platform type of the container image, must be `x64-workstation` for x86-64 system.
2525

2626
:::{note}
2727
If `<APP_PATH>` refers to a python code (such as `./my_app.py`), the whole parent folder of the file would be packaged into the MAP container image, effectively the same as specifying the application folder path which includes `__main__.py` file. In both cases, the image's environment variable, `HOLOSCAN_APPLICATION` will be set with the path of the application folder in the image, i.e. `HOLOSCAN_APPLICATION=/opt/holoscan/app`. So, it is essential to provide the `__main__.py` file in the application folder, which usually would look like below:
@@ -54,7 +54,7 @@ The following lists a few most likely used [optional arguments](https://docs.nvi
5454
Given an example MONAI Deploy App SDK application with its code residing in a directory `./my_app`, packaging this application with the Packager to create a Docker image tagged `my_app:latest` would look like this:
5555

5656
```bash
57-
$ monai-deploy package ./my_app -c --config ./my_app/app.yaml -t my_app:latest --models ./model.ts --platform x86_64
57+
$ monai-deploy package ./my_app -c --config ./my_app/app.yaml -t my_app:latest --models ./model.ts --platform x64-workstation
5858

5959
Building MONAI Application Package...
6060
Successfully built my_app:latest
@@ -65,7 +65,7 @@ The MAP image name will be postfixed with the platform info to become `my_app-x6
6565
:::{note}
6666
* The current implementation of the Packager **ONLY** supports a set of [platform](https://docs.nvidia.com/holoscan/sdk-user-guide/cli/package.html#platform-platform) specific base images from `nvcr.io` as base images for the MAP.
6767

68-
* To package a MAP to run on ARMv8 AArch64 on Linux with discrete GPU, replace the commandline option `--platform x86_64` with `--platform igx-dgpu`. It has been tested on [NVIDIA IGX Orin](https://www.nvidia.com/en-us/edge-computing/products/igx/).
68+
* To package a MAP to run on ARMv8 AArch64 on Linux with discrete GPU, replace the commandline option `--platform x64-workstation` with `--platform igx-orin-devkit --platform-config dgpu`. It has been tested on [NVIDIA IGX Orin](https://www.nvidia.com/en-us/edge-computing/products/igx/).
6969
:::
7070

7171
## Next Step

docs/source/getting_started/tutorials/mednist_app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jupyter-lab
4242
<div style="text-align: center;">
4343
<iframe width="560" height="315" src="https://www.youtube.com/embed/WwjilJFHuU4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
4444
45-
<p>Video may show the use of previous SDK verson.</p>
45+
<p>Video may show the use of previous SDK version.</p>
4646
</div>
4747
```
4848

docs/source/getting_started/tutorials/monai_bundle_app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jupyter-lab
3232
<div style="text-align: center;">
3333
<iframe width="560" height="315" src="https://www.youtube.com/embed/nivgfD4pwWE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
3434
35-
<p>Video may show the use of previous SDK verson.</p>
35+
<p>Video may show the use of previous SDK version.</p>
3636
</div>
3737
```
3838

examples/apps/breast_density_classifier_app/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Sample data and a torchscript model can be downloaded from https://drive.google.
99
python app.py -i <input_dir> -o <out_dir> -m <breast_density_model>
1010
```
1111

12-
## Package the application as a MONAI Application Package (contianer image)
12+
## Package the application as a MONAI Application Package (container image)
1313
In order to build the MONAI App Package, go a level up and execute the following command.
1414
```
1515
monai-deploy package breast_density_classification_app -m <breast_density_model> -c breast_density_classifer_app/app.yaml --tag breast_density:0.1.0 --platform x64-workstation -l DEBUG
@@ -20,4 +20,4 @@ monai-deploy package breast_density_classification_app -m <breast_density_model>
2020
monai-deploy run breast_density-x64-workstation-dgpu-linux-amd64:0.1.0 -i <input_dir> -o <output_dir>
2121
```
2222

23-
Once the container exits successfully, check the results in the output directory. There should be a newly creeated DICOM instance file and a `output.json` file containing the classification results.
23+
Once the container exits successfully, check the results in the output directory. There should be a newly created DICOM instance file and a `output.json` file containing the classification results.
Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
1-
import logging
2-
from pathlib import Path
3-
import torch
4-
from diffusers import StableDiffusionPipeline
5-
from monai.deploy.core import AppContext, Application
6-
from PIL import Image
7-
import numpy as np
81
import argparse
2+
import logging
3+
4+
import torch
5+
from diffusers import StableDiffusionPipeline
96

7+
from monai.deploy.core import Application
108

119

1210
class App(Application):
13-
name = "Diffusion Image App"
14-
description = "Simple application showing diffusion to generate Images"
15-
def compose(self):
16-
model_id = "Nihirc/Prompt2MedImage"
17-
device = "cuda"
18-
parser = argparse.ArgumentParser()
19-
parser.add_argument("--input_prompt", type=str, default="Generate a X-ray")
20-
parser.add_argument("--output", type=str, default="./out.jpg")
21-
args = parser.parse_args()
22-
23-
input_prompt = args.input_prompt
24-
output_path = args.output
25-
print("Input Prompt: ", input_prompt)
26-
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
27-
pipe = pipe.to(device)
28-
prompt = "Show me an X ray pevic fracture"
29-
image = pipe(prompt).images[0]
30-
image.save(output_path)
11+
name = "Diffusion Image App"
12+
description = "Simple application showing diffusion to generate Images"
13+
14+
def compose(self):
15+
model_id = "Nihirc/Prompt2MedImage"
16+
device = "cuda"
17+
parser = argparse.ArgumentParser()
18+
parser.add_argument("--input_prompt", type=str, default="Generate a X-ray")
19+
parser.add_argument("--output", type=str, default="./out.jpg")
20+
args = parser.parse_args()
21+
22+
input_prompt = args.input_prompt
23+
output_path = args.output
24+
print("Input Prompt: ", input_prompt)
25+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
26+
pipe = pipe.to(device)
27+
prompt = "Show me an X ray pevic fracture"
28+
image = pipe(prompt).images[0]
29+
image.save(output_path)
3130

3231

3332
if __name__ == "__main__":
34-
logging.info(f"Begin {__name__}")
35-
App().run()
36-
logging.info(f"End {__name__}")
37-
38-
39-
33+
logging.info(f"Begin {__name__}")
34+
App().run()
35+
logging.info(f"End {__name__}")

monai/deploy/operators/dicom_seg_writer_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def __init__(
206206
Object encapsulating the description of each segment present in the segmentation.
207207
output_folder: Folder for file output, overridden by named input on compute.
208208
Defaults to current working dir's child folder, output.
209-
custom_tags: Optonal[Dict[str, str]], optional
209+
custom_tags: Optional[Dict[str, str]], optional
210210
Dictionary for setting custom DICOM tags using Keywords and str values only
211211
omit_empty_frames: bool, optional
212212
Whether to omit frames that contain no segmented pixels from the output segmentation.

notebooks/tutorials/02_mednist_app.ipynb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@
416416
},
417417
{
418418
"cell_type": "code",
419-
"execution_count": 13,
419+
"execution_count": null,
420420
"metadata": {},
421421
"outputs": [
422422
{
@@ -439,7 +439,7 @@
439439
"# Choose a file as test input\n",
440440
"test_input_path = image_files[0][0]\n",
441441
"!rm -rf {input_folder} && mkdir -p {input_folder} && cp {test_input_path} {input_folder} && ls {input_folder}\n",
442-
"# Need to copy the model file to its own clean subfolder for pacakging, to workaround an issue in the Packager\n",
442+
"# Need to copy the model file to its own clean subfolder for packaging, to workaround an issue in the Packager\n",
443443
"!rm -rf {models_folder} && mkdir -p {models_folder}/model && cp classifier.zip {models_folder}/model && ls {models_folder}/model\n",
444444
"\n",
445445
"%env HOLOSCAN_INPUT_PATH {input_folder}\n",
@@ -558,7 +558,7 @@
558558
},
559559
{
560560
"cell_type": "code",
561-
"execution_count": 16,
561+
"execution_count": null,
562562
"metadata": {},
563563
"outputs": [],
564564
"source": [
@@ -579,7 +579,7 @@
579579
"\n",
580580
" def __init__(\n",
581581
" self,\n",
582-
" frament: Fragment,\n",
582+
" fragment: Fragment,\n",
583583
" *args,\n",
584584
" app_context: AppContext,\n",
585585
" model_name: Optional[str] = \"\",\n",
@@ -606,7 +606,7 @@
606606
" # The name of the optional input port for passing data to override the output folder path.\n",
607607
" self.input_name_output_folder = \"output_folder\"\n",
608608
"\n",
609-
" # The output folder set on the object can be overriden at each compute by data in the optional named input\n",
609+
" # The output folder set on the object can be overridden at each compute by data in the optional named input\n",
610610
" self.output_folder = output_folder\n",
611611
"\n",
612612
" # Need the name when there are multiple models loaded\n",
@@ -617,7 +617,7 @@
617617
" self.model = self._get_model(self.app_context, self.model_path, self._model_name)\n",
618618
"\n",
619619
" # This needs to be at the end of the constructor.\n",
620-
" super().__init__(frament, *args, **kwargs)\n",
620+
" super().__init__(fragment, *args, **kwargs)\n",
621621
"\n",
622622
" def _get_model(self, app_context: AppContext, model_path: Path, model_name: str):\n",
623623
" \"\"\"Load the model with the given name from context or model path\n",
@@ -839,7 +839,7 @@
839839
},
840840
{
841841
"cell_type": "code",
842-
"execution_count": 21,
842+
"execution_count": null,
843843
"metadata": {},
844844
"outputs": [
845845
{
@@ -954,7 +954,7 @@
954954
"\n",
955955
" def __init__(\n",
956956
" self,\n",
957-
" frament: Fragment,\n",
957+
" fragment: Fragment,\n",
958958
" *args,\n",
959959
" app_context: AppContext,\n",
960960
" model_name: Optional[str] = \"\",\n",
@@ -981,7 +981,7 @@
981981
" # The name of the optional input port for passing data to override the output folder path.\n",
982982
" self.input_name_output_folder = \"output_folder\"\n",
983983
"\n",
984-
" # The output folder set on the object can be overriden at each compute by data in the optional named input\n",
984+
" # The output folder set on the object can be overridden at each compute by data in the optional named input\n",
985985
" self.output_folder = output_folder\n",
986986
"\n",
987987
" # Need the name when there are multiple models loaded\n",
@@ -992,7 +992,7 @@
992992
" self.model = self._get_model(self.app_context, self.model_path, self._model_name)\n",
993993
"\n",
994994
" # This needs to be at the end of the constructor.\n",
995-
" super().__init__(frament, *args, **kwargs)\n",
995+
" super().__init__(fragment, *args, **kwargs)\n",
996996
"\n",
997997
" def _get_model(self, app_context: AppContext, model_path: Path, model_name: str):\n",
998998
" \"\"\"Load the model with the given name from context or model path\n",

run

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ install_edit_mode() {
407407

408408
setup_desc() { c_echo 'Setup development environment
409409
410-
Arguements:
410+
Arguments:
411411
$1 - configuration (default: "dev")
412412
'
413413
}
@@ -468,7 +468,7 @@ build_desc() { c_echo 'Build distribution package
468468
Build a distribution package for this SDK using
469469
"build" (https://pypa-build.readthedocs.io/en/stable/index.html).
470470
471-
Arguements:
471+
Arguments:
472472
$1 - destination folder (default: ${TOP}/dist)
473473
'
474474
}
@@ -970,7 +970,7 @@ setup_gen_docs() {
970970

971971
gen_docs_desc() { c_echo 'Generate documents
972972
973-
Generated docs would be avaialable at ${TOP}/dist/docs.
973+
Generated docs would be available at ${TOP}/dist/docs.
974974
975975
Arguments:
976976
$1 - output folder path (html docs)
@@ -1012,7 +1012,7 @@ gen_docs_dev_desc() { c_echo 'Generate documents (with dev-server)
10121012
10131013
Launch dev-server for sphinx.
10141014
1015-
Generated docs would be avaialable at ${TOP}/dist/docs.
1015+
Generated docs would be available at ${TOP}/dist/docs.
10161016
10171017
Arguments:
10181018
-p <port> - port number

0 commit comments

Comments
 (0)