-
Notifications
You must be signed in to change notification settings - Fork 60
App SDK updated to be compatible with monai 1.0.0 and its MetaTensor #360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
…d code smell. Signed-off-by: M Q <mingmelvinq@nvidia.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MMelQin Do we have the sample data for liver tumor somewhere that we can test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the notebook tutorials I am getting the following error.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In [6], line 1
----> 1 app = AISpleenSegApp()
3 app.run(input="dcm", output="output", model="model.ts")
Cell In [5], line 4, in AISpleenSegApp.__init__(self, *args, **kwargs)
3 def __init__(self, *args, **kwargs):
----> 4 super().__init__(*args, **kwargs)
File ~/Documents/MONAI-DEPLOY/monai-deploy-app-sdk/monai/deploy/core/application.py:126, in Application.__init__(self, runtime_env, do_run, path)
123 self._builder()
125 # Compose operators
--> 126 self.compose()
128 if do_run:
129 self.run(log_level=args.log_level)
Cell In [5], line 12, in AISpleenSegApp.compose(self)
10 series_to_vol_op = DICOMSeriesToVolumeOperator()
11 # Creates DICOM Seg writer with segment label name in a string list
---> 12 dicom_seg_writer = DICOMSegmentationWriterOperator(seg_labels=["Spleen"])
14 # Creates the model specific segmentation operator
15 spleen_seg_op = SpleenSegOperator()
TypeError: __init__() missing 1 required positional argument: 'segment_descriptions'
Thanks @vikashg I'll update the Notebook. It was in fact a different issue, originated from the change of DICOM Seg Writer API. I was planning to get it address in a separate PR, but will include it in this one. For Liver Tumor test dataset, the test data was from Medical Decathlon in NIfTI format originally, and then converted to DICOM using 3D Slicer. The original image was oriented using Neurology viewing convention, RAS, instead of LPS for Rad, so the DICOM image is shown flipped in MicroDicom. |
| inputs = self.pre_process(inputs) | ||
| first_input = inputs.pop(first_input_name)[None].to(self._device) # select first input | ||
| input_metadata = inputs.get(f"{first_input_name}_{self._meta_key_postfix}", None) | ||
| first_input_v = inputs[first_input_name] # keep a copy of value for later use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need deepcopy here?
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The InvertD has changed to look for image dict name instead of relying on image_metadata_dict. It was not clear to me if it matters the [image] value is before or post inference or even preprocessing. So, the intend here is really just to keep a reference to the value part of dict for adding back the key, image, because of the pop of key, image. I tried not to use pop but somehow directly using inputs[first_input_name].to(self._device) did not work.
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
|
Kudos, SonarCloud Quality Gate passed!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it looks good to me.
…roject-MONAI#360) * Updated to be compitable with monai 1.0.0 and its MetaTensor Signed-off-by: M Q <mingmelvinq@nvidia.com> * Made bundle inference operator compatible with MetaTensor Signed-off-by: M Q <mingmelvinq@nvidia.com> * Removed the use of ToTensor from all apps. Signed-off-by: M Q <mingmelvinq@nvidia.com> * Fix MyPy complaints Signed-off-by: M Q <mingmelvinq@nvidia.com> * Fix isort complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> * Use a constant for repeated use of monai.utils str literal; SonarCloud code smell. Signed-off-by: M Q <mingmelvinq@nvidia.com> * Updated Seg Writer and Spleen Seg Jupyter notebooks Signed-off-by: M Q <mingmelvinq@nvidia.com> * Minor to address comments and checker complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> * Updated clara-viz Jupyter notebook and fixed checking complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> Signed-off-by: M Q <mingmelvinq@nvidia.com> Signed-off-by: Simone Bendazzoli <simben@kth.se>
…roject-MONAI#360) * Updated to be compitable with monai 1.0.0 and its MetaTensor Signed-off-by: M Q <mingmelvinq@nvidia.com> * Made bundle inference operator compatible with MetaTensor Signed-off-by: M Q <mingmelvinq@nvidia.com> * Removed the use of ToTensor from all apps. Signed-off-by: M Q <mingmelvinq@nvidia.com> * Fix MyPy complaints Signed-off-by: M Q <mingmelvinq@nvidia.com> * Fix isort complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> * Use a constant for repeated use of monai.utils str literal; SonarCloud code smell. Signed-off-by: M Q <mingmelvinq@nvidia.com> * Updated Seg Writer and Spleen Seg Jupyter notebooks Signed-off-by: M Q <mingmelvinq@nvidia.com> * Minor to address comments and checker complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> * Updated clara-viz Jupyter notebook and fixed checking complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> Signed-off-by: M Q <mingmelvinq@nvidia.com> Signed-off-by: Simone Bendazzoli <simben@kth.se>








The pull request is to make App SDK compatible with monai 1.0.0, specifically the use of MetaTensor
ToTensorDin the inference pre-processing stepMetaKeysclass etcimage, to post_processing, since the metadata dict is now encapsulated in the MetaTensorspip install ipywidgets==7.7.2before the clara-viz package is updated to be compatible with neweripywidgetsSigned-off-by: M Q mingmelvinq@nvidia.com