Skip to content

Conversation

@MMelQin
Copy link
Collaborator

@MMelQin MMelQin commented Aug 5, 2025

  • For the App SDK, the Python version is now >=3.10, <3.14, but because of the doc build requirements settings have issue causing failure on ReadTheDocs, keeping the min version at 3.9 till another PR to address the doc build.
  • Use of NumPy can_cast with Python type is removed as the function stopped support Python types in NumPy >=2.0.
  • Update the "DICOM series to volume image" operator to use pydicom apply_rescale directly which returns NumPy array
  • Tested Jupyter notebooks (using locally built SDK for monai-deploy package command).
Min Python version is now 3.10 Use of NumPy can_cast with Python type is removed Update the DICOM series to volume image to use pydicom apply_rescale directly Tested Jupyter notebooks (using locally built SDK for monai-deploy package command) Signed-off-by: M Q <mingmelvinq@nvidia.com>
@MMelQin MMelQin self-assigned this Aug 5, 2025
@MMelQin MMelQin linked an issue Aug 5, 2025 that may be closed by this pull request
@MMelQin MMelQin requested a review from Copilot August 5, 2025 21:04

This comment was marked as outdated.

MMelQin added 5 commits August 5, 2025 14:21
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
The doc build requirements need to be fully examined and updated in another PR Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
@MMelQin MMelQin requested a review from Copilot August 5, 2025 22:50

This comment was marked as outdated.

MMelQin added 2 commits August 5, 2025 16:25
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
@MMelQin MMelQin requested a review from Copilot August 5, 2025 23:38

This comment was marked as outdated.

@MMelQin MMelQin requested review from bluna301 and mocsharp August 5, 2025 23:43
MMelQin added 3 commits August 5, 2025 18:36
Signed-off-by: M Q <mingmelvinq@nvidia.com>
…float64. In the last version, rescale slope and intercept values were tried to cast to the smallest can_cast Nunpy type. Using pydicom apply_rescale loses this as it returns float64 if rescale slope and intercept are applied. So, enhancing the code will test for equivalence before "unsafely" casting the data. This will NOT reduce the mem usage of this operator as a new array will be created by casting from float64, and there is a small overhead for the checks. However, there are cases where downstream custom operators may save memory footprint. Signed-off-by: M Q <mingmelvinq@nvidia.com>
…rry to min size. Signed-off-by: M Q <mingmelvinq@nvidia.com>
@MMelQin MMelQin requested a review from Copilot August 8, 2025 01:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the MONAI Deploy App SDK to ensure compatibility with HSDK v3.5.0, addressing Python version requirements and NumPy API changes. The changes focus on maintaining compatibility while resolving deprecation issues.

  • Updates Python version requirements from >=3.9 to >=3.9,<3.14 and documentation examples to use Python 3.10
  • Refactors DICOM series to volume operator to use pydicom's apply_rescale function directly instead of deprecated NumPy can_cast with Python types
  • Improves memory efficiency by pre-allocating volume arrays and using pydicom utilities for pixel data processing

Reviewed Changes

Copilot reviewed 9 out of 12 changed files in this pull request and generated 1 comment.

File Description
setup.cfg Updates Python version constraint to support up to 3.13
monai/deploy/operators/dicom_series_to_volume_operator.py Major refactor to use pydicom utilities and improve memory efficiency
README.md Updates Python version requirement documentation
docs/source/getting_started/tutorials/*.md Updates tutorial setup instructions from Python 3.9 to 3.10
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Copy link
Contributor

@bluna301 bluna301 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. For the DSTVO, essentially just outsourcing the existing logic to the pydicom methods (which were previously being emulating) with improved memory usage and slice-by-slice checks.

Only minor suggestion (take it or leave it) would be to make the casting logs ("Rescaled pixel array can be safely cast to {datatype} with equivalence test.") debug, or somehow consolidate them into a single log. That being said, it is nice to see the details of how the casting is occurring, so I think I would ultimately be fine keeping these as info logs.

Signed-off-by: M Q <mingmelvinq@nvidia.com>
@MMelQin MMelQin merged commit 9f7a4ad into main Aug 26, 2025
5 checks passed
@MMelQin MMelQin deleted the mq/update_for_hsdk3.5 branch November 5, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants