Skip to content

Commit

Permalink
Update to release v2.0 that is dependent on HSDK v2 (#485)
Browse files Browse the repository at this point in the history
* Update to use HSDK v2

Signed-off-by: M Q <[email protected]>

* Supress the new Flake8 complaints

Signed-off-by: M Q <[email protected]>

* Avoid loading DICOMDir and tested all notebooks

Signed-off-by: M Q <[email protected]>

* fix flake8 complaint

Signed-off-by: M Q <[email protected]>

* logging the UID, if present, of the ignored instance

Signed-off-by: M Q <[email protected]>

---------

Signed-off-by: M Q <[email protected]>
  • Loading branch information
MMelQin authored Apr 24, 2024
1 parent ea0c032 commit ca30b03
Show file tree
Hide file tree
Showing 12 changed files with 2,442 additions and 2,069 deletions.
15 changes: 15 additions & 0 deletions monai/deploy/operators/dicom_data_loader_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class DICOMDataLoaderOperator(Operator):

DEFAULT_INPUT_FOLDER = Path.cwd() / "input"
DEFAULT_OUTPUT_NAME = "dicom_study_list"
SOP_CLASSES_TO_IGNORE = [
"1.2.840.10008.1.3.10", # Media Storage Directory Storage, aka DICOMDIR
]

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

# First need to eliminate the SOP instances whose SOP Class is to be ignored.
if "SOPInstanceUID" not in sop_instance:
self._logger.warn("Instance ignored due to missing SOP instance UID tag")
continue
sop_instance_uid = sop_instance["SOPInstanceUID"].value
if "SOPClassUID" not in sop_instance:
self._logger.warn(f"Instance ignored due to missing SOP Class UID tag, {sop_instance_uid}")
continue
if sop_instance["SOPClassUID"].value in DICOMDataLoaderOperator.SOP_CLASSES_TO_IGNORE:
self._logger.warn(f"Instance ignored for being in the ignored class, {sop_instance_uid}")
continue

if study_instance_uid not in study_dict:
study = DICOMStudy(study_instance_uid)
self.populate_study_attributes(study, sop_instance)
Expand Down
649 changes: 320 additions & 329 deletions notebooks/tutorials/01_simple_app.ipynb

Large diffs are not rendered by default.

796 changes: 457 additions & 339 deletions notebooks/tutorials/02_mednist_app-prebuilt.ipynb

Large diffs are not rendered by default.

518 changes: 270 additions & 248 deletions notebooks/tutorials/02_mednist_app.ipynb

Large diffs are not rendered by default.

760 changes: 414 additions & 346 deletions notebooks/tutorials/03_segmentation_app.ipynb

Large diffs are not rendered by default.

227 changes: 119 additions & 108 deletions notebooks/tutorials/03_segmentation_viz_app.ipynb

Large diffs are not rendered by default.

913 changes: 526 additions & 387 deletions notebooks/tutorials/04_monai_bundle_app.ipynb

Large diffs are not rendered by default.

621 changes: 315 additions & 306 deletions notebooks/tutorials/05_multi_model_app.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ scikit-image>=0.17.2
nibabel>=3.2.1
numpy-stl>=2.12.0
trimesh>=3.8.11
torch~=2.0.1
torch>=2.0.1
4 changes: 1 addition & 3 deletions requirements-examples.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ PyPDF2>=2.11.1
highdicom>=0.18.2
SimpleITK>=2.0.0
Pillow>=8.4.0
numpy-stl>=2.12.0
trimesh>=3.8.11
nibabel>=3.2.1
numpy-stl>=2.12.0
trimesh>=3.8.11
torch~=2.0.1
torch>=2.0.1
monai>=1.0.0
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
holoscan~=1.0
holoscan~=2.0
numpy>=1.21.6
colorama>=0.4.1
typeguard>=3.0.0
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ python_requires = >= 3.8
# cucim
install_requires =
numpy>=1.21.6
holoscan~=1.0
holoscan~=2.0
colorama>=0.4.1
typeguard>=3.0.0

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

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

0 comments on commit ca30b03

Please sign in to comment.