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

5844 improve metatensor slicing #5845

Merged
merged 2 commits into from
Jan 13, 2023
Merged

Conversation

wyli
Copy link
Contributor

@wyli wyli commented Jan 11, 2023

Signed-off-by: Wenqi Li wenqil@nvidia.com

Fixes #5844

  • improves the error message when slicing data with inconsistent metadata
  • fixes an indexing case:
x = MetaTensor(np.zeros((10, 3, 4)))
x[slice(1, 0)]  # should return zero length data

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.

@wyli wyli force-pushed the 5844-slicing-metatensor branch from f32306a to 4aa3df4 Compare January 11, 2023 21:38
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
@wyli wyli force-pushed the 5844-slicing-metatensor branch from 4aa3df4 to 8250ca7 Compare January 11, 2023 21:39
@wyli
Copy link
Contributor Author

wyli commented Jan 11, 2023

/build

1 similar comment
@wyli
Copy link
Contributor Author

wyli commented Jan 11, 2023

/build

@wyli wyli marked this pull request as ready for review January 11, 2023 22:23
@wyli
Copy link
Contributor Author

wyli commented Jan 13, 2023

could you please review @Nic-Ma?

monai/data/meta_tensor.py Outdated Show resolved Hide resolved
@wyli
Copy link
Contributor Author

wyli commented Jan 13, 2023

/build

@wyli wyli merged commit f14d50a into Project-MONAI:dev Jan 13, 2023
@wyli wyli deleted the 5844-slicing-metatensor branch January 13, 2023 16:16
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.

Slicing a MetaTensor: TypeError: only integer tensors of a single element can be converted to an index
2 participants