Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[bumpversion]
current_version = 0.3.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>a|b|rc)(?P<build>\d+))?
serialize =
serialize =
{major}.{minor}.{patch}{release}{build}
{major}.{minor}.{patch}
tag_name = {new_version}
Expand All @@ -11,7 +11,7 @@ commit_args = -s
tag = True

[bumpversion:part:release]
values =
values =
a
b
rc
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ plotly
nibabel
monai
pydicom
highdicom>=0.16.0
sphinx-autodoc-typehints==1.12.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
Expand Down
10 changes: 7 additions & 3 deletions docs/source/release_notes/v0.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ You can learn more about SDK usage through [DEVELOPING WITH SDK](/developing_wit
Please let us know how you like it and what could be improved by [submitting an issue](https://github.com/Project-MONAI/monai-deploy-app-sdk/issues/new/choose) or [asking questions](https://github.com/Project-MONAI/monai-deploy-app-sdk/discussions)

## What's new

### Clara Viz Operator

This operator uses [Clara Viz](https://pypi.org/project/clara-viz/) to provide interactive view of a 3D volume including segmentation mask. A [tutorial](https://github.com/Project-MONAI/monai-deploy-app-sdk/blob/main/notebooks/tutorials/03_segmentation_viz_app.ipynb) is provided to demonstrate how to use this new operator in an application, e.g., a typical segmentation inference application.

### STL Surface Mesh Conversion Operator

This operator converts a volume image to surface mesh, in [STL file format](https://en.wikipedia.org/wiki/STL_(file_format)). Its API allows the client to control if smoothing needs to be applied, and if only keeping the largest connected component; the latter is useful when muliple disjoint segments are in a volume image, and the application needs to control if all or only the largest to be included in the output.

### What's fixed or updated
## What's fixed/updated

- [The AI Spleen Segmentation](https://github.com/Project-MONAI/monai-deploy-app-sdk/tree/main/examples/apps/ai_spleen_seg_app) application is updated to include the STL conversion operator for surface mesh output
- [The AI UNETR Segmentation](https://github.com/Project-MONAI/monai-deploy-app-sdk/blob/main/examples/apps/ai_unetr_seg_app/app.py) is updated to include the STL conversion operator, in lieu of the [DICOM Segmentation Writer](https://github.com/Project-MONAI/monai-deploy-app-sdk/blob/main/monai/deploy/operators/dicom_seg_writer_operator.py). This is because that the model outputs 13 labeled segments, exceeding the maximum of 8 supported by the [DICOM Segmentation Writer](https://github.com/Project-MONAI/monai-deploy-app-sdk/blob/main/monai/deploy/operators/dicom_seg_writer_operator.py)
- Add Clara Viz operator [#235](https://github.com/Project-MONAI/monai-deploy-app-sdk/pull/235) by [@AndreasHeumann](https://github.com/AndreasHeumann)
Expand All @@ -30,7 +34,7 @@ This operator converts a volume image to surface mesh, in [STL file format](http
- Fix doc typos [#274](https://github.com/Project-MONAI/monai-deploy-app-sdk/pull/274) by [@mmelqin](https://github.com/MMelQin)
- Added 3rd party copyright notices [#278](https://github.com/Project-MONAI/monai-deploy-app-sdk/pull/278) by [@mmelqin](https://github.com/MMelQin)
- Fix pixel spacing in DICOMDataLoaderOperator for some X-rays [#280](https://github.com/Project-MONAI/monai-deploy-app-sdk/pull/280) by [@jlvahldiek](https://github.com/jlvahldiek)
- Issue (#283) Fix shm issue [#284](https://github.com/Project-MONAI/monai-deploy-app-sdk/pull/284) by [@slbryson](https://github.com/slbryson)
- Fix shm issue [#284](https://github.com/Project-MONAI/monai-deploy-app-sdk/pull/284) by [@slbryson](https://github.com/slbryson)
- Fix Issue #245: DICOM Seg has multiple slices of seg image on the same frame [#285](https://github.com/Project-MONAI/monai-deploy-app-sdk/pull/285) by [@mmelqin](https://github.com/MMelQin)
- Update MONAI version after having validated compatibility [#288](https://github.com/Project-MONAI/monai-deploy-app-sdk/pull/288) by [@mmelqin](https://github.com/MMelQin)
- Add support for MONOCHROME1 [#290](https://github.com/Project-MONAI/monai-deploy-app-sdk/pull/290) by [@mmelqin](https://github.com/MMelQin)
- Add support for MONOCHROME1 [#290](https://github.com/Project-MONAI/monai-deploy-app-sdk/pull/290) by [@mmelqin](https://github.com/MMelQin)
37 changes: 34 additions & 3 deletions examples/apps/ai_livertumor_seg_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
from monai.deploy.operators.dicom_series_selector_operator import DICOMSeriesSelectorOperator
from monai.deploy.operators.dicom_series_to_volume_operator import DICOMSeriesToVolumeOperator
from monai.deploy.operators.publisher_operator import PublisherOperator
from monai.deploy.utils.importutil import optional_import

hd, _ = optional_import("highdicom")
codes, _ = optional_import("pydicom.sr.codedict", name="codes")


@resource(cpu=1, gpu=1, memory="7Gi")
Expand All @@ -41,6 +45,33 @@ def compose(self):
"""Creates the app specific operators and chain them up in the processing DAG."""

self._logger.debug(f"Begin {self.compose.__name__}")

# The segment descriptions are needed to describe the two segments
liver_segment_description = hd.seg.SegmentDescription(
segment_number=1,
segment_label="Liver",
segmented_property_category=codes.SCT.Organ,
segmented_property_type=codes.SCT.Liver,
algorithm_type=hd.seg.SegmentAlgorithmTypeValues.AUTOMATIC,
algorithm_identification=hd.AlgorithmIdentificationSequence(
name="MONAI Deploy Liver Tumor Segmentation Example",
family=codes.DCM.ArtificialIntelligence,
version=version_str,
),
)
tumor_segment_description = hd.seg.SegmentDescription(
segment_number=2,
segment_label="Liver Tumor",
segmented_property_category=codes.SCT.MorphologicallyAbnormalStructure,
segmented_property_type=codes.SCT.Tumor,
algorithm_type=hd.seg.SegmentAlgorithmTypeValues.AUTOMATIC,
algorithm_identification=hd.AlgorithmIdentificationSequence(
name="MONAI Deploy Liver Tumor Segmentation Example",
family=codes.DCM.ArtificialIntelligence,
version=version_str,
),
)

# Creates the custom operator(s) as well as SDK built-in operator(s).
study_loader_op = DICOMDataLoaderOperator()
series_selector_op = DICOMSeriesSelectorOperator()
Expand All @@ -53,9 +84,9 @@ def compose(self):

# Creates DICOM Seg writer with segment label name in a string list
dicom_seg_writer = DICOMSegmentationWriterOperator(
seg_labels=[
"Liver",
"Tumor",
segment_descriptions=[
liver_segment_description,
tumor_segment_description,
]
)
# Create the processing pipeline, by specifying the upstream and downstream operators, and
Expand Down
26 changes: 25 additions & 1 deletion examples/apps/ai_spleen_seg_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
from monai.deploy.operators.dicom_series_selector_operator import DICOMSeriesSelectorOperator
from monai.deploy.operators.dicom_series_to_volume_operator import DICOMSeriesToVolumeOperator
from monai.deploy.operators.stl_conversion_operator import STLConversionOperator
from monai.deploy.utils.importutil import optional_import

hd, _ = optional_import("highdicom")
codes, _ = optional_import("pydicom.sr.codedict", name="codes")


@resource(cpu=1, gpu=1, memory="7Gi")
Expand All @@ -41,14 +45,34 @@ def compose(self):

self._logger.debug(f"Begin {self.compose.__name__}")

try:
version_str = get_sdk_semver() # SDK Version
except Exception:
version_str = "0.1" # Fall back to the initial version

segment_descriptions = [
hd.seg.SegmentDescription(
segment_number=1,
segment_label="Spleen",
segmented_property_category=codes.SCT.Organ,
segmented_property_type=codes.SCT.Spleen,
algorithm_type=hd.seg.SegmentAlgorithmTypeValues.AUTOMATIC,
algorithm_identification=hd.AlgorithmIdentificationSequence(
name="MONAI Deploy Spleen Segmentation Example",
family=codes.DCM.ArtificialIntelligence,
version=version_str,
),
)
]

# Creates the custom operator(s) as well as SDK built-in operator(s).
study_loader_op = DICOMDataLoaderOperator()
series_selector_op = DICOMSeriesSelectorOperator(Sample_Rules_Text)
series_to_vol_op = DICOMSeriesToVolumeOperator()
# Model specific inference operator, supporting MONAI transforms.
spleen_seg_op = SpleenSegOperator()
# Create DICOM Seg writer with segment label name in a string list
dicom_seg_writer = DICOMSegmentationWriterOperator(seg_labels=["Spleen"])
dicom_seg_writer = DICOMSegmentationWriterOperator(segment_descriptions)
# Create the surface mesh STL conversion operator
stl_conversion_op = STLConversionOperator(output_file="stl/spleen.stl")

Expand Down
2 changes: 1 addition & 1 deletion examples/apps/ai_spleen_seg_app/spleen_seg_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
class SpleenSegOperator(Operator):
"""Performs Spleen segmentation with a 3D image converted from a DICOM CT series.

This operator makes use of the App SDK MonaiSegInferenceOperator in a compsition approach.
This operator makes use of the App SDK MonaiSegInferenceOperator in a composition approach.
It creates the pre-transforms as well as post-transforms with MONAI dictionary based transforms.
Note that the App SDK InMemImageReader, derived from MONAI ImageReader, is passed to LoadImaged.
This derived reader is needed to parse the in memory image object, and return the expected data structure.
Expand Down
Loading