Skip to content

Commit 063f9f1

Browse files
authored
Updated the mednist notebooks adding the dependencies of pydicom and highdicom (#435)
* Updated the mednist notebooks adding the dependencies of pydicom and highdicom. Signed-off-by: M Q <[email protected]> * rerun the notebook Signed-off-by: M Q <[email protected]> * Update and reran notebook Signed-off-by: M Q <[email protected]> * Update the simple imaging app to resolve a PIL image error and reran notebook Signed-off-by: M Q <[email protected]> * Fix isort complaint Signed-off-by: M Q <[email protected]> * Update all notebook runs, regarded as part of QA Signed-off-by: M Q <[email protected]> * remove the unnecessary print statement Signed-off-by: M Q <[email protected]> --------- Signed-off-by: M Q <[email protected]>
1 parent 1437309 commit 063f9f1

File tree

9 files changed

+6386
-2601
lines changed

9 files changed

+6386
-2601
lines changed

examples/apps/mednist_classifier_monaideploy/mednist_classifier_monaideploy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def compute(self, op_input: InputContext, op_output: OutputContext, context: Exe
9595

9696

9797
@md.resource(cpu=1, gpu=1, memory="1Gi")
98+
@md.env(pip_packages=["pydicom >= 2.3.0", "highdicom>=0.18.2", "typeguard~=2.12.1"])
9899
class App(Application):
99100
"""Application class for the MedNIST classifier."""
100101

examples/apps/simple_imaging_app/gaussian_operator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@ class GaussianOperator(Operator):
2525
"""
2626

2727
def compute(self, op_input: InputContext, op_output: OutputContext, context: ExecutionContext):
28+
import numpy as np
2829
from skimage.filters import gaussian
2930
from skimage.io import imsave
3031

3132
data_in = op_input.get().asnumpy()
3233
data_out = gaussian(data_in, sigma=0.2, channel_axis=2) # Add the param introduced in 0.19.
3334

35+
# Make sure the data type is what PIL Image can support, as the imsave function calls PIL Image fromarray()
36+
# Some details can be found at https://stackoverflow.com/questions/55319949/pil-typeerror-cannot-handle-this-data-type
37+
if np.max(data_out) <= 1:
38+
data_out = (data_out * 255).astype(np.uint8)
39+
3440
output_folder = op_output.get().path
3541
output_path = output_folder / "final_output.png"
3642
imsave(output_path, data_out)

notebooks/tutorials/01_simple_app.ipynb

Lines changed: 161 additions & 106 deletions
Large diffs are not rendered by default.

notebooks/tutorials/02_mednist_app-prebuilt.ipynb

Lines changed: 2068 additions & 85 deletions
Large diffs are not rendered by default.

notebooks/tutorials/02_mednist_app.ipynb

Lines changed: 1639 additions & 55 deletions
Large diffs are not rendered by default.

notebooks/tutorials/03_segmentation_app.ipynb

Lines changed: 657 additions & 501 deletions
Large diffs are not rendered by default.

notebooks/tutorials/03_segmentation_viz_app.ipynb

Lines changed: 427 additions & 372 deletions
Large diffs are not rendered by default.

notebooks/tutorials/06_monai_bundle_app.ipynb

Lines changed: 174 additions & 649 deletions
Large diffs are not rendered by default.

notebooks/tutorials/07_multi_model_app.ipynb

Lines changed: 1253 additions & 833 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)