Skip to content

Fix for Numpy Unsigned Array Conversion#5082

Merged
wyli merged 7 commits intoProject-MONAI:devfrom
ericspod:convert_to_tensor-fix
Sep 6, 2022
Merged

Fix for Numpy Unsigned Array Conversion#5082
wyli merged 7 commits intoProject-MONAI:devfrom
ericspod:convert_to_tensor-fix

Conversation

@ericspod
Copy link
Copy Markdown
Member

@ericspod ericspod commented Sep 3, 2022

Signed-off-by: Eric Kerfoot [email protected]

Description

Numpy arrays with type uint16, uint32, and uint64 need to be converted to signed versions before conversion to Pytorch tensors. This is relevant because MR data is often stored in uint16 format.

Status

Ready/Work in progress/Hold

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@ericspod ericspod changed the title Fix for type issue when converting certain unsigned Numpy arrays to P… Fix for Numpy Unsigned Array Conversion Sep 3, 2022
@ericspod ericspod marked this pull request as ready for review September 4, 2022 16:39
@ericspod ericspod requested review from Nic-Ma, rijobro and wyli September 4, 2022 16:39
Copy link
Copy Markdown
Contributor

@Nic-Ma Nic-Ma left a comment

Choose a reason for hiding this comment

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

Looks good to me.
@wyli Do you have any other comments?

Thanks.

@ericspod
Copy link
Copy Markdown
Member Author

ericspod commented Sep 5, 2022

@Nic-Ma Thanks for the review, I've changed it however to use view() instead of astype() to avoid copying.

@wyli
Copy link
Copy Markdown
Contributor

wyli commented Sep 6, 2022

/build

@wyli wyli enabled auto-merge (squash) September 6, 2022 07:20
@wyli
Copy link
Copy Markdown
Contributor

wyli commented Sep 6, 2022

/build

@wyli wyli disabled auto-merge September 6, 2022 10:06
@wyli wyli enabled auto-merge (squash) September 6, 2022 10:06
@wyli wyli merged commit 7fc5cf8 into Project-MONAI:dev Sep 6, 2022
@ericspod ericspod deleted the convert_to_tensor-fix branch September 6, 2022 12:30
wyli pushed a commit to yashika-git/MONAI that referenced this pull request Sep 6, 2022
Signed-off-by: Eric Kerfoot <[email protected]>

### Description
Numpy arrays with type uint16, uint32, and uint64 need to be converted to signed versions before conversion to Pytorch tensors. This is relevant because MR data is often stored in uint16 format.

### Status
**Ready**

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not applicable items -->
- [x] Non-breaking change (fix or new feature that would not break existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests  --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/` folder.

Signed-off-by: Eric Kerfoot <[email protected]>
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.

3 participants