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 <[email protected]>
@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
Copilot

This comment was marked as outdated.

@MMelQin MMelQin requested a review from Copilot August 5, 2025 22:50
Copilot

This comment was marked as outdated.

@MMelQin MMelQin requested a review from Copilot August 5, 2025 23:38
Copilot

This comment was marked as outdated.

@MMelQin MMelQin requested review from mocsharp and bluna301 August 5, 2025 23:43
MMelQin added 3 commits August 5, 2025 18:36
…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 <[email protected]>
@MMelQin MMelQin requested a review from Copilot August 8, 2025 01:52
Copy link

@Copilot 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

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.

Copy link

@MMelQin MMelQin merged commit 9f7a4ad into main Aug 26, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] TypeError encountered in dicom_series_to_volume_operator.py
3 participants