|
4 | 4 | "cell_type": "markdown", |
5 | 5 | "metadata": {}, |
6 | 6 | "source": [ |
7 | | - "# Creating a Segmentation App with MONAI Deploy App SDK\n", |
| 7 | + "# Creating a Segmentation App Including Visualization with MONAI Deploy App SDK\n", |
8 | 8 | "\n", |
9 | | - "This tutorial shows how to create an organ segmentation application for a PyTorch model that has been trained with MONAI.\n", |
| 9 | + "This tutorial shows how to create an organ segmentation application for a PyTorch model that has been trained with MONAI, and visualize the segmentation and input images with Clara Viz integration.\n", |
10 | 10 | "\n", |
11 | 11 | "Deploying AI models requires the integration with clinical imaging network, even if in a for-research-use setting. This means that the AI deploy application will need to support standards-based imaging protocols, and specifically for Radiological imaging, DICOM protocol.\n", |
12 | 12 | "\n", |
|
42 | 42 | " - **Input(seg_image)**: a segmentation image object in memory ([`Image`](/modules/_autosummary/monai.deploy.core.domain.Image))\n", |
43 | 43 | " - **Input(study_selected_series_list)**: a DICOM series object in memory ([`StudySelectedSeries`](/modules/_autosummary/monai.deploy.core.domain.StudySelectedSeries))\n", |
44 | 44 | " - **Output(dicom_seg_instance)**: a file path ([`DataPath`](/modules/_autosummary/monai.deploy.core.domain.DataPath))\n", |
| 45 | + "- **ClaraVizOperator**:\n", |
| 46 | + " - **Input(image)**: a volume image object in memory ([`Image`](/modules/_autosummary/monai.deploy.core.domain.Image))\n", |
| 47 | + " - **Input(seg_image)**: a segmentation image object in memory ([`Image`](/modules/_autosummary/monai.deploy.core.domain.Image))\n", |
45 | 48 | "\n", |
46 | 49 | "\n", |
47 | 50 | ":::{note}\n", |
|
61 | 64 | " DICOMSeriesToVolumeOperator --|> SpleenSegOperator : image...image\n", |
62 | 65 | " DICOMSeriesSelectorOperator --|> DICOMSegmentationWriterOperator : study_selected_series_list...study_selected_series_list\n", |
63 | 66 | " SpleenSegOperator --|> DICOMSegmentationWriterOperator : seg_image...seg_image\n", |
| 67 | + " DICOMSeriesToVolumeOperator --|> ClaraVizOperator : image...image\n", |
| 68 | + " SpleenSegOperator --|> ClaraVizOperator : seg_image...seg_image\n", |
64 | 69 | "\n", |
65 | 70 | "\n", |
66 | 71 | " class DICOMDataLoaderOperator {\n", |
|
85 | 90 | " <in>study_selected_series_list : IN_MEMORY\n", |
86 | 91 | " dicom_seg_instance(out) DISK\n", |
87 | 92 | " }\n", |
| 93 | + " class ClaraVizOperator {\n", |
| 94 | + " <in>image : IN_MEMORY\n", |
| 95 | + " <in>seg_image : IN_MEMORY\n", |
| 96 | + " }\n", |
88 | 97 | "```\n", |
89 | 98 | "\n", |
90 | 99 | "### Setup environment\n" |
|
1208 | 1217 | "from monai.deploy.operators.dicom_seg_writer_operator import DICOMSegmentationWriterOperator\n", |
1209 | 1218 | "from monai.deploy.operators.dicom_series_selector_operator import DICOMSeriesSelectorOperator\n", |
1210 | 1219 | "from monai.deploy.operators.dicom_series_to_volume_operator import DICOMSeriesToVolumeOperator\n", |
| 1220 | + "from monai.deploy.operators.clara_viz_operator import ClaraVizOperator\n", |
1211 | 1221 | "\n", |
1212 | 1222 | "@resource(cpu=1, gpu=1, memory=\"7Gi\")\n", |
1213 | 1223 | "class AISpleenSegApp(Application):\n", |
|
1231 | 1241 | " self.add_flow(series_selector_op, dicom_seg_writer, {\"study_selected_series_list\": \"study_selected_series_list\"})\n", |
1232 | 1242 | " self.add_flow(spleen_seg_op, dicom_seg_writer, {\"seg_image\": \"seg_image\"})\n", |
1233 | 1243 | "\n", |
| 1244 | + " viz_op = ClaraVizOperator()\n", |
| 1245 | + " self.add_flow(series_to_vol_op, viz_op, {\"image\": \"image\"})\n", |
| 1246 | + " self.add_flow(spleen_seg_op, viz_op, {\"seg_image\": \"seg_image\"})\n", |
| 1247 | + "\n", |
1234 | 1248 | "# This is a sample series selection rule in JSON, simply selecting CT series.\n", |
1235 | 1249 | "# If the study has more than 1 CT series, then all of them will be selected.\n", |
1236 | 1250 | "# Please see more detail in DICOMSeriesSelectorOperator.\n", |
|
0 commit comments