Skip to content

Commit ca30b03

Browse files
authored
Update to release v2.0 that is dependent on HSDK v2 (#485)
* Update to use HSDK v2 Signed-off-by: M Q <mingmelvinq@nvidia.com> * Supress the new Flake8 complaints Signed-off-by: M Q <mingmelvinq@nvidia.com> * Avoid loading DICOMDir and tested all notebooks Signed-off-by: M Q <mingmelvinq@nvidia.com> * fix flake8 complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> * logging the UID, if present, of the ignored instance Signed-off-by: M Q <mingmelvinq@nvidia.com> --------- Signed-off-by: M Q <mingmelvinq@nvidia.com>
1 parent ea0c032 commit ca30b03

12 files changed

+2442
-2069
lines changed

monai/deploy/operators/dicom_data_loader_operator.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class DICOMDataLoaderOperator(Operator):
4242

4343
DEFAULT_INPUT_FOLDER = Path.cwd() / "input"
4444
DEFAULT_OUTPUT_NAME = "dicom_study_list"
45+
SOP_CLASSES_TO_IGNORE = [
46+
"1.2.840.10008.1.3.10", # Media Storage Directory Storage, aka DICOMDIR
47+
]
4548

4649
# For now, need to have the input folder as an instance attribute, set on init, because even there is the optional
4750
# named input to receive data containing the path, there might not be upstream operator to emit the data.
@@ -170,6 +173,18 @@ def _load_data(self, files: List[str]):
170173
for sop_instance in sop_instances:
171174
study_instance_uid = sop_instance[0x0020, 0x000D].value.name # name is the UID as str
172175

176+
# First need to eliminate the SOP instances whose SOP Class is to be ignored.
177+
if "SOPInstanceUID" not in sop_instance:
178+
self._logger.warn("Instance ignored due to missing SOP instance UID tag")
179+
continue
180+
sop_instance_uid = sop_instance["SOPInstanceUID"].value
181+
if "SOPClassUID" not in sop_instance:
182+
self._logger.warn(f"Instance ignored due to missing SOP Class UID tag, {sop_instance_uid}")
183+
continue
184+
if sop_instance["SOPClassUID"].value in DICOMDataLoaderOperator.SOP_CLASSES_TO_IGNORE:
185+
self._logger.warn(f"Instance ignored for being in the ignored class, {sop_instance_uid}")
186+
continue
187+
173188
if study_instance_uid not in study_dict:
174189
study = DICOMStudy(study_instance_uid)
175190
self.populate_study_attributes(study, sop_instance)

notebooks/tutorials/01_simple_app.ipynb

Lines changed: 320 additions & 329 deletions
Large diffs are not rendered by default.

notebooks/tutorials/02_mednist_app-prebuilt.ipynb

Lines changed: 457 additions & 339 deletions
Large diffs are not rendered by default.

notebooks/tutorials/02_mednist_app.ipynb

Lines changed: 270 additions & 248 deletions
Large diffs are not rendered by default.

notebooks/tutorials/03_segmentation_app.ipynb

Lines changed: 414 additions & 346 deletions
Large diffs are not rendered by default.

notebooks/tutorials/03_segmentation_viz_app.ipynb

Lines changed: 119 additions & 108 deletions
Large diffs are not rendered by default.

notebooks/tutorials/04_monai_bundle_app.ipynb

Lines changed: 526 additions & 387 deletions
Large diffs are not rendered by default.

notebooks/tutorials/05_multi_model_app.ipynb

Lines changed: 315 additions & 306 deletions
Large diffs are not rendered by default.

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ scikit-image>=0.17.2
3535
nibabel>=3.2.1
3636
numpy-stl>=2.12.0
3737
trimesh>=3.8.11
38-
torch~=2.0.1
38+
torch>=2.0.1

requirements-examples.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ PyPDF2>=2.11.1
44
highdicom>=0.18.2
55
SimpleITK>=2.0.0
66
Pillow>=8.4.0
7-
numpy-stl>=2.12.0
8-
trimesh>=3.8.11
97
nibabel>=3.2.1
108
numpy-stl>=2.12.0
119
trimesh>=3.8.11
12-
torch~=2.0.1
10+
torch>=2.0.1
1311
monai>=1.0.0

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
holoscan~=1.0
1+
holoscan~=2.0
22
numpy>=1.21.6
33
colorama>=0.4.1
44
typeguard>=3.0.0

setup.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ python_requires = >= 3.8
2424
# cucim
2525
install_requires =
2626
numpy>=1.21.6
27-
holoscan~=1.0
27+
holoscan~=2.0
2828
colorama>=0.4.1
2929
typeguard>=3.0.0
3030

@@ -51,6 +51,8 @@ ignore =
5151
B905,
5252
# B026 Star-arg unpacking after a keyword argument is strongly discouraged
5353
B026
54+
# B909 editing a loop's mutable iterable often leads to unexpected results/bugs
55+
B909
5456

5557
per_file_ignores =
5658
# e.g. F403 'from holoscan.conditions import *' used; unable to detect undefined names

0 commit comments

Comments
 (0)