Skip to content
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

[Enhancement] Use of the missing attribute on the DicomInstance class #413

Open
MMelQin opened this issue Mar 23, 2023 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@MMelQin
Copy link
Collaborator

MMelQin commented Mar 23, 2023

Describe the bug
New version of pytype has found a new error, see below. Since this particular operator will still be used in the new versions of the App SDK, the flagged error needs to be investigated. Also note, there is currently no runtime error.

File "/home/mqin/src/monai-deploy-app-sdk/monai/deploy/operators/dicom_series_to_volume_operator.py", line 229, in prepare_series: No attribute 'first_pixel_on_slice_normal' on monai.deploy.core.domain.dicom_sop_instance.DICOMSOPInstance [attribute-error]

Steps/Code to reproduce bug

  • Inspect the said file, and try to find the attribute, or
  • In the pytype settings, make sure in the disable dose not contains 'attribute-error', and then run pytype on monai/deploy

Expected behavior
There should not be attribute-error and this particular error should not be disableed in the pytype settings.

Environment details (please complete the following information)

  • OS/Platform: Linux
  • Python Version: 3.7/3.8
  • Method of MONAI Deploy App SDK install: [from source]
  • SDK Version: 0.5/main

Additional context
This error is currently disabled in pytype report, so that the pull request build can succeed. Creating this bug is to schedule a real fix.

@MMelQin MMelQin added the bug Something isn't working label Mar 23, 2023
@MMelQin MMelQin self-assigned this Mar 23, 2023
@MMelQin MMelQin changed the title [BUG] [BUG] Use of the missing attribute on the DicomInstance class Mar 23, 2023
@MMelQin
Copy link
Collaborator Author

MMelQin commented Mar 24, 2023

The attributes, distance and first_pixel_on_slice_normal are added to an instantiated DICOMInstance object, as they are calculated for specific DICOMSeries instance, see here and here, before referenced in the subsequent code block. So, it correctly uses the python language feature but the pytype somehow did not infer it correctly and raised false positive error.

The code for correct, but disabling attribute-error reporting from pytype is not a good idea. Will consider in the next release/migration to add the attributes to the init function, and in the meantime disable attribute-error reporting when checking code before PR and build.

@MMelQin MMelQin added enhancement New feature or request and removed bug Something isn't working labels Mar 24, 2023
@MMelQin MMelQin changed the title [BUG] Use of the missing attribute on the DicomInstance class [Enhancement] Use of the missing attribute on the DicomInstance class Mar 24, 2023
@github-project-automation github-project-automation bot moved this to Done in v0.6.0 Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

1 participant