Skip to content

Commit 971a567

Browse files
authored
Mqin/fix mednist app error missing nibabel pkg (#308)
* Change to use optional import and explicitly add dependencies to dev and example requirements files. Signed-off-by: mmelqin <mingmelvinq@nvidia.com> * Formatting Signed-off-by: mmelqin <mingmelvinq@nvidia.com> * Add comments Signed-off-by: mmelqin <mingmelvinq@nvidia.com>
1 parent 46d19d0 commit 971a567

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

monai/deploy/operators/stl_conversion_operator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
from pathlib import Path
1717
from typing import Dict, Optional
1818

19-
import nibabel as nib
2019
import numpy as np
2120

2221
from monai.deploy.utils.importutil import optional_import
2322

23+
nib, _ = optional_import("nibabel")
2424
sitk, _ = optional_import("SimpleITK")
2525
label, _ = optional_import("skimage.measure", name="label")
2626
measure, _ = optional_import("skimage", name="measure")
@@ -36,7 +36,10 @@
3636

3737
@md.input("image", Image, IOType.IN_MEMORY)
3838
@md.output("stl_output", DataPath, IOType.DISK)
39-
@md.env(pip_packages=["numpy>=1.21", "numpy-stl>=2.12.0", "scikit-image>=0.17.2", "trimesh>=3.8.11"])
39+
# nibabel is required by the dependent class STLConverter.
40+
@md.env(
41+
pip_packages=["numpy>=1.21", "nibabel >= 3.2.1", "numpy-stl>=2.12.0", "scikit-image>=0.17.2", "trimesh>=3.8.11"]
42+
)
4043
class STLConversionOperator(Operator):
4144
"""Converts volumetric image to surface mesh in STL format, file output only."""
4245

requirements-dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,7 @@ pydicom>=1.4.2
2929
SimpleITK>=2.0.0
3030
Pillow>=8.0.0
3131
bump2version==1.0.1
32+
scikit-image >= 0.17.2
33+
nibabel >= 3.2.1
34+
numpy-stl >= 2.12.0
35+
trimesh >= 3.8.11

requirements-examples.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ pydicom >= 1.4.2
33
SimpleITK >= 2.0.0
44
Pillow >= 8.0.0
55
nibabel >= 3.2.1
6+
numpy-stl >= 2.12.0
7+
trimesh >= 3.8.11

0 commit comments

Comments
 (0)