Skip to content

Handle exception case with missing DICOM Rescale Intercept and Slope attributes #236

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

Merged
merged 2 commits into from
Jan 12, 2022

Conversation

MMelQin
Copy link
Collaborator

@MMelQin MMelQin commented Jan 12, 2022

Per Issue #187, added exception handling when parsing Rescale Intercept (0028,1052) and Rescale Slope (0028,1053).

  • Rescale Intercept (0028,1052) is of Type 1C. It is required if Modality LUT Sequence (0028,3000) is not present, and shall not be present otherwise.
  • Rescale Slope (0028,1053) is also Type 1C, required if Rescale Intercept is present.
  • Rescale Type (0028, 1054) is not parsed or used in the implementation as of now. This attribute is required if Rescale Intercept is present.

These attributes have been observed missing, even in the absence of LUT, in DICOM instances generated with open source utility tools that converts NIfTI image to DICOM. It is safe to use 0 and 1 for the intercept and slope to handle the exception.

The code change has been tested successfully with a DICOM series known to be missing the said attributes.

Note: the build/test failure is due to mypy checking, and the errors are from the runner and packager, not in the modules affected by this PR, as shown below.

Checking styles using mypy...
2022-01-12 07:36:06 $ python3 -m mypy --version
mypy 0.931
2022-01-12 07:36:07 $ python3 -m mypy --namespace-packages --explicit-package-bases /home/runner/work/monai-deploy-app-sdk/monai-deploy-app-sdk
monai/deploy/runner/run_command.py:44:5: error: Returning Any from function declared to return "ArgumentParser"  [no-any-return]
monai/deploy/packager/package_command.py:48:5: error: Returning Any from function declared to return "ArgumentParser"  [no-any-return]
monai/deploy/cli/exec_command.py:55:5: error: Returning Any from function declared to return "ArgumentParser"  [no-any-return]
Found 3 errors in 3 files (checked 112 source files)
mypy check failed!
Error: Process completed with exit code 1.

@MMelQin MMelQin force-pushed the mqin/issue_187_rescale_intercept branch 3 times, most recently from 8be54f2 to cfeac9e Compare January 12, 2022 07:56
Signed-off-by: mmelqin <mingmelvinq@nvidia.com>
Copy link
Collaborator

@gigony gigony left a comment

Choose a reason for hiding this comment

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

Thank you Ming! Looks good to me!

@MMelQin MMelQin merged commit 6a0d60c into main Jan 12, 2022
@gigony gigony mentioned this pull request Jan 25, 2022
@MMelQin MMelQin deleted the mqin/issue_187_rescale_intercept branch February 3, 2025 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DICOMSeriesToVolumeOperator fails when DICOM instances do not have (0028, 1052), Rescale Intercept attribute
2 participants